﻿/****************************** Module Header ******************************\
* Module Name:  UiWebCustomFunctions.cs
* Project:	    YR.CUIT.Framework
* Copyright (c) Yogaratnam Rahulan.
* 
* The class UiWebCustomFunctions is a web form custom functions Object which runs within IE Explorer and offers additional services.
* 
* A UiWebCustomFunctions is a dynamic-link library (DLL) capable of attaching itself to any new 
* instance of Internet Explorer or Windows Explorer. Such a module can get in touch 
* with the browser through the container's .  
* 
* This class is used to make the test automation easier and BDD/TDD manner development. It also supplies 
* functions to intracts with Web pop-up on IE.
* 
* This source is subject to the Yogaratnam Rahulan Public License.
* See Soon
* All other rights reserved.
* 
* THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, 
* EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED 
* WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
\***************************************************************************/

using System;
using System.Drawing;
using System.Security;
using System.Windows.Forms;
using Microsoft.VisualStudio.TestTools.UITest.Extension;
using Microsoft.VisualStudio.TestTools.UITesting;
using Microsoft.VisualStudio.TestTools.UITesting.HtmlControls;
using Microsoft.VisualStudio.TestTools.UITesting.WinControls;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using YR.CUIT.SearchFilterEngine;
using Keyboard = Microsoft.VisualStudio.TestTools.UITesting.Keyboard;
using System.Diagnostics;

namespace YR.CUIT.Framework
{
    public partial class UiWebCustomFunctions
    {
        #region config
        private BrowserWindow _browser = null;
        private ApplicationUnderTest _application;


        Microsoft.VisualStudio.TestTools.UITesting.HtmlControls.HtmlDocument _dom;

        private Microsoft.VisualStudio.TestTools.UITesting.HtmlControls.HtmlDocument GetHtmlDocument()
        {
            var chooseFileDialog = new BrowserWindow();
            _dom = chooseFileDialog.SearchAndFilterObjects<Microsoft.VisualStudio.TestTools.UITesting.HtmlControls.HtmlDocument>(new { ControlType = "Document" });
            _dom.TechnologyName = "Web";
            return _dom;
        }

        #endregion

        #region Locate Web Object Type
        private UITestControl GetPopIframeDom(string pageid = "", string pageurl = "")
        {
            return HandleExceptions(() =>
            {
                _dom = _browser.SearchAndFilterObjects<Microsoft.VisualStudio.TestTools.UITesting.HtmlControls.HtmlDocument>(new { ControlType = "Document" });
                _dom.TechnologyName = "Web";
                if (_dom != null)
                {
                    _dom.WaitForControlReady();
                    if (pageid != string.Empty && pageurl != string.Empty)
                    {
                        var dialog = _dom.Container.SearchAndFilterObjects<HtmlIFrame>(new { ID = pageid }, new { PageUrl = pageurl });
                        if (dialog != null)
                        {
                            dialog.WaitForControlReady();
                        }
                        else
                        {
                            Assert.Fail("GetIframeDom :: Control not loaded");

                        }
                    }
                }
                return _dom;
            });
        }
        #endregion

        #region Launch & Clsoe application
        public BrowserWindow LaunchWebAppUrlWithUserNamePassword(string path, string altpath, string args, string username, SecureString password, string domain)
        {
            return HandleExceptions(() =>
            {
                _application = ApplicationUnderTest.Launch(path, altpath, args, username, password, domain);
                //get all the controls we want to use - this uses dynamic types for serach and filter properties
                if (!_application.Maximized)
                {
                    _application.Maximized = true;
                }
                _browser = _application.SearchAndFilterObjects<BrowserWindow>(
                    // pass search properties
                    new { Name = args },
                    //pass filter properties if needed 
                    new { ClassName = altpath });

                if (_browser != null)
                    _dom = _browser.SearchAndFilterObjects<Microsoft.VisualStudio.TestTools.UITesting.HtmlControls.HtmlDocument>(new { ControlType = "Document" });

                return _browser;
            });
        }
        public BrowserWindow LaunchWebAppUrl(string path, string altpath, string args)
        {
            return HandleExceptions(() =>
            {
                _application = ApplicationUnderTest.Launch(path, altpath, args);

                _browser = _application.SearchAndFilterObjects<BrowserWindow>(
                   new { Name = args },
                   new { ClassName = altpath });
                if (_browser != null)
                    _dom = _browser.SearchAndFilterObjects<Microsoft.VisualStudio.TestTools.UITesting.HtmlControls.HtmlDocument>(new { ControlType = "Document" });
                return _browser;
            });
        }
        public BrowserWindow LaunchWebAppUrl(string uripath)
        {
            return HandleExceptions(() =>
            {
                if (_browser == null)
                {
                    _browser = BrowserWindow.Launch(new Uri(uripath));
                    if (!_browser.Maximized)
                    {
                        _browser.Maximized = true;
                        _browser.WaitForControlExist();
                        _dom = _browser.SearchAndFilterObjects<Microsoft.VisualStudio.TestTools.UITesting.HtmlControls.HtmlDocument>(new { ControlType = "Document" });
                    }
                }

                return _browser;
            });
        }
        public BrowserWindow CloseAllOpenBrowserWindow()
        {
            return HandleExceptions(() =>
            {
                var browser = new BrowserWindow();
                if (browser != null)
                    browser.Close();
                return browser;
            });
        }
        /// <summary>
        /// Launches a Web browser window
        /// </summary>
        /// <returns></returns>
        public BrowserWindow LaunchInternetExplorer()
        {
            return HandleExceptions(() =>
            {
                if (_browser == null)
                {
                    _browser = BrowserWindow.Launch();
                    if (!_browser.Maximized)
                    {
                        _browser.Maximized = true;
                        _browser.WaitForControlExist();
                        _dom = _browser.SearchAndFilterObjects<Microsoft.VisualStudio.TestTools.UITesting.HtmlControls.HtmlDocument>(new { ControlType = "Document" });
                    }
                }
                return _browser;
            });
        }
        /// <summary>
        /// Close the Web browser window
        /// </summary>
        public void CloseWebAppUnderTest()
        {
            HandleExceptions(() =>
            {
                if (_browser != null)
                    _browser.Close();
            });
        }
        /// <summary>
        /// Close the application
        /// </summary>
        public void CloseAppUnderTest()
        {
            HandleExceptions(() =>
            {
                if (_application != null)
                {
                    _application.Close();
                }
            });
        }
        #endregion

        #region Launch IE as Admin
        public void LaunchWebAppAsAdminUser(string filename, string altpath, string argu, string user, string password, string domain)
        {
            HandleExceptions(() =>
            {
                var passwords = new SecureString();
                char[] pwd = password.ToCharArray();
                foreach (char c in pwd)
                {
                    passwords.AppendChar(c);
                }
                LaunchWebAppUrlWithUserNamePassword(filename, altpath, argu, user, passwords, domain);
            });
        }
        #endregion

        #region Navigate to URL
        public UITestControl NavigateWebUrl(string url)
        {
            return HandleExceptions(() =>
            {
                if (_browser != null)
                {
                    _browser.NavigateToUrl(new Uri(url));
                }
                return _browser;
            });
        }
        #endregion

        #region Locate Web HyperLinks, Image link and do the actions
        public HtmlHyperlink LocateWebLink(string href = "", string target = "", string innertext = "", string id = "", string name = "")
        {
            return HandleExceptions(() =>
            {
                _dom = _browser.SearchAndFilterObjects<Microsoft.VisualStudio.TestTools.UITesting.HtmlControls.HtmlDocument>(new { ControlType = "Document" });
                var link = new HtmlHyperlink();

                if (_dom != null)
                {
                    _dom.WaitForControlReady();
                    if (href != string.Empty && innertext != string.Empty)
                        link = _dom.SearchAndFilterObjects<HtmlHyperlink>(new { Href = href, InnerText = innertext });
                    else if (name != string.Empty && innertext != string.Empty)
                        link = _dom.SearchAndFilterObjects<HtmlHyperlink>(new { Name = name }, new { InnerText = innertext });
                    else if (target != string.Empty && innertext != string.Empty)
                        link = _dom.SearchAndFilterObjects<HtmlHyperlink>(new { Target = target, InnerText = innertext });
                    else if (target != string.Empty && id != string.Empty)
                        link = _dom.SearchAndFilterObjects<HtmlHyperlink>(new { Target = target }, new { Id = id });
                    else if (id != string.Empty && innertext != string.Empty)
                        link = _dom.SearchAndFilterObjects<HtmlHyperlink>(new { ID = id }, new { InnerText = innertext });
                    else if (id != string.Empty && name != string.Empty)
                        link = _dom.SearchAndFilterObjects<HtmlHyperlink>(new { Id = id, Name = name });
                    else if (id != string.Empty && href != string.Empty)
                        link = _dom.SearchAndFilterObjects<HtmlHyperlink>(new { Id = id }, new { Href = href });
                    else if (href != string.Empty)
                        link = _dom.SearchAndFilterObjects<HtmlHyperlink>(new { Href = href });
                    else if (innertext != string.Empty)
                        link = _dom.SearchAndFilterObjects<HtmlHyperlink>(new { InnerText = innertext });
                    else if (id != string.Empty)
                        link = _dom.SearchAndFilterObjects<HtmlHyperlink>(new { Id = id });
                    else if (name != string.Empty)
                        link = _dom.SearchAndFilterObjects<HtmlHyperlink>(new { Name = name });
                    else if (target != string.Empty)
                        link = _dom.SearchAndFilterObjects<HtmlHyperlink>(new { Target = target });
                    if (link != null)
                    {
                        link.WaitForControlReady();
                    }
                    else
                    {
                        Assert.Fail("LocateWebLink :: Control not loaded");

                    }
                }
                return link;
            });
        }
        public HtmlHyperlink LocateWebLinkAndClick(string href = "", string target = "", string innertext = "", string id = "", string name = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebLink(href: href, target: target, innertext: innertext, id: id, name: name);
                if (ctrl != null)
                {
                    Mouse.Click(ctrl);
                }
                return ctrl;
            });
        }
        public HtmlHyperlink LocateWebLinkAndHover(string href = "", string target = "", string innertext = "", string id = "", string name = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebLink(href: href, target: target, innertext: innertext, id: id, name: name);
                if (ctrl != null)
                {
                    Mouse.Hover(ctrl);
                }
                return ctrl;
            });
        }

        public UITestControl LocateWebPopIframeLink(string pageid = "", string pageurl = "", string href = "", string target = "", string name = "", string id = "", string innertext = "")
        {
            return HandleExceptions(() =>
            {
                var getDom = GetPopIframeDom(pageid: pageid, pageurl: pageurl);
                var ctrl = new HtmlHyperlink(getDom);

                if (getDom != null)
                {
                    getDom.WaitForControlReady();
                    if (href != string.Empty && innertext != string.Empty)
                        ctrl = ctrl.SearchAndFilterObjects<HtmlHyperlink>(new { Href = href, InnerText = innertext });
                    else if (name != string.Empty && innertext != string.Empty)
                        ctrl = ctrl.SearchAndFilterObjects<HtmlHyperlink>(new { Name = name }, new { InnerText = innertext });
                    else if (target != string.Empty && innertext != string.Empty)
                        ctrl = ctrl.SearchAndFilterObjects<HtmlHyperlink>(new { Target = target, InnerText = innertext });
                    else if (target != string.Empty && id != string.Empty)
                        ctrl = ctrl.SearchAndFilterObjects<HtmlHyperlink>(new { Target = target }, new { Id = id });
                    else if (id != string.Empty && innertext != string.Empty)
                        ctrl = ctrl.SearchAndFilterObjects<HtmlHyperlink>(new { ID = id }, new { InnerText = innertext });
                    else if (id != string.Empty && name != string.Empty)
                        ctrl = ctrl.SearchAndFilterObjects<HtmlHyperlink>(new { Id = id, Name = name });
                    else if (id != string.Empty && href != string.Empty)
                        ctrl = ctrl.SearchAndFilterObjects<HtmlHyperlink>(new { Id = id }, new { Href = href });
                    else if (href != string.Empty)
                        ctrl = ctrl.SearchAndFilterObjects<HtmlHyperlink>(new { Href = href });
                    else if (innertext != string.Empty)
                        ctrl = ctrl.SearchAndFilterObjects<HtmlHyperlink>(new { InnerText = innertext });
                    else if (id != string.Empty)
                        ctrl = ctrl.SearchAndFilterObjects<HtmlHyperlink>(new { Id = id });
                    else if (name != string.Empty)
                        ctrl = ctrl.SearchAndFilterObjects<HtmlHyperlink>(new { Name = name });
                    else if (target != string.Empty)
                        ctrl = ctrl.SearchAndFilterObjects<HtmlHyperlink>(new { Target = target });
                    if (ctrl != null)
                    {
                        ctrl.WaitForControlReady();
                    }
                    else
                    {
                        Assert.Fail("LocateWebPopIframeLink :: Control not loaded");

                    }
                }
                return ctrl;
            });
        }
        public UITestControl LocateWebPopIframeLinkAndClick(string pageid = "", string pageurl = "", string href = "", string target = "", string name = "", string id = "", string innertext = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebPopIframeLink(pageid: pageid, pageurl: pageurl, href: href, target: target, name: name, id: id, innertext: innertext);
                if (ctrl != null)
                {
                    Mouse.Click(new Point(ctrl.BoundingRectangle.X + 50, ctrl.BoundingRectangle.Y + 14));
                }
                return ctrl;
            });
        }
        public UITestControl LocateWebPopIframeLinkAndHover(string pageid = "", string pageurl = "", string href = "", string target = "", string name = "", string id = "", string innertext = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebPopIframeLink(pageid: pageid, pageurl: pageurl, href: href, target: target, name: name, id: id, innertext: innertext);
                if (ctrl != null)
                {
                    Mouse.Hover(new Point(ctrl.BoundingRectangle.X + 50, ctrl.BoundingRectangle.Y + 14));
                }
                return ctrl;
            });
        }

        public UITestControl LocateSharepointPopLink(string id = "", string name = "", string sclass = "", string innertext = "", string title = "", string target = "")
        {
            return HandleExceptions(() =>
            {
                var Obj = new UITestControl(_browser);
                Obj.TechnologyName = "Web";

                if (Obj != null)
                {
                    if (id != string.Empty)
                        Obj.SearchProperties.Add(HtmlHyperlink.PropertyNames.Id, id);
                    else if (name != string.Empty)
                        Obj.SearchProperties.Add(HtmlHyperlink.PropertyNames.Name, name);
                    else if (sclass != string.Empty)
                        Obj.SearchProperties.Add(HtmlHyperlink.PropertyNames.Class, sclass);
                    else if (innertext != string.Empty)
                        Obj.SearchProperties.Add(HtmlHyperlink.PropertyNames.InnerText, innertext);
                    else if (title != string.Empty)
                        Obj.SearchProperties.Add(HtmlHyperlink.PropertyNames.Title, title);
                    else if (target != string.Empty)
                        Obj.SearchProperties.Add(HtmlHyperlink.PropertyNames.Target, target);
                    if (Obj != null)
                    {
                        Obj.WaitForControlReady();
                    }
                }
                else
                {
                    Assert.Fail("LocateSharepointPopLink :: Control not loaded");
                }
                return Obj;
            });
        }
        public UITestControl LocateSharepointPopLinkAndClick(string id = "", string name = "", string sclass = "", string innertext = "", string title = "", string target = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateSharepointPopLink(id: id, name: name, sclass: sclass, innertext: innertext, title: title);
                if (ctrl != null)
                {
                    Mouse.Click(ctrl);
                }
                return ctrl;
            });
        }
        public UITestControl LocateSharepointPopLinkAndPointClick(string id = "", string name = "", string sclass = "", string innertext = "", string title = "", string target = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateSharepointPopLink(id: id, name: name, sclass: sclass, innertext: innertext, title: title);
                if (ctrl != null)
                {
                    Mouse.Click(new Point(ctrl.BoundingRectangle.X + 40, ctrl.BoundingRectangle.Y + 14));
                }
                return ctrl;
            });
        }
        public UITestControl LocateSharepointPopLinkAndDoubleClick(string id = "", string name = "", string sclass = "", string innertext = "", string title = "", string target = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateSharepointPopLink(id: id, name: name, sclass: sclass, innertext: innertext, title: title);
                if (ctrl != null)
                {
                    Mouse.DoubleClick(ctrl);
                }
                return ctrl;
            });
        }
        public UITestControl LocateSharepointPopLinkAndPointDoubleClick(string id = "", string name = "", string sclass = "", string innertext = "", string title = "", string target = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateSharepointPopLink(id: id, name: name, sclass: sclass, innertext: innertext, title: title);
                if (ctrl != null)
                {
                    Mouse.DoubleClick(new Point(ctrl.BoundingRectangle.X + 50, ctrl.BoundingRectangle.Y + 14));
                }
                return ctrl;
            });
        }
        public UITestControl LocateSharepointPopLinkAndHover(string id = "", string name = "", string sclass = "", string innertext = "", string title = "", string target = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateSharepointPopLink(id: id, name: name, sclass: sclass, innertext: innertext, title: title);
                if (ctrl != null)
                {
                    Mouse.Hover(ctrl);
                }
                return ctrl;
            });
        }


        public UITestControl LocateWebPoppageLink(string href = "", string target = "", string name = "", string id = "", string innertext = "")
        {
            return HandleExceptions(() =>
            {
                var getDom = GetHtmlDocument();
                var ctrl = new HtmlHyperlink(getDom);

                if (getDom != null)
                {
                    getDom.WaitForControlReady();
                    if (id != string.Empty)
                        ctrl.SearchProperties.Add(HtmlHyperlink.PropertyNames.Id, id);
                    else if (name != string.Empty)
                        ctrl.SearchProperties.Add(HtmlHyperlink.PropertyNames.Name, name);
                    else if (href != string.Empty)
                        ctrl.SearchProperties.Add(HtmlHyperlink.PropertyNames.Href, href);
                    else if (innertext != string.Empty)
                        ctrl.SearchProperties.Add(HtmlHyperlink.PropertyNames.InnerText, innertext);
                    else if (target != string.Empty)
                        ctrl.SearchProperties.Add(HtmlHyperlink.PropertyNames.Target, target);
                    else if (target != string.Empty)
                        ctrl.SearchProperties.Add(HtmlHyperlink.PropertyNames.Target, target);
                    if (ctrl != null)
                    {
                        ctrl.WaitForControlReady();
                    }
                    else
                    {
                        Assert.Fail("LocateWebPoppageLink :: Control not loaded");

                    }
                }
                return ctrl;
            });
        }
        public UITestControl LocateWebPoppageLinkAndClick(string href = "", string target = "", string name = "", string id = "", string innertext = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebPoppageLink(href: href, target: target, innertext: innertext, id: id, name: name);
                if (ctrl != null)
                {
                    Mouse.Click(ctrl);
                }
                return ctrl;
            });
        }
        public UITestControl LocateWebPoppageLinkAndHover(string href = "", string target = "", string name = "", string id = "", string innertext = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebPoppageLink(href: href, target: target, innertext: innertext, id: id, name: name);
                if (ctrl != null)
                {
                    Mouse.Hover(ctrl);
                }
                return ctrl;
            });
        }

        public HtmlImage LocateWebImgLink(string id = "", string src = "", string alt = "")
        {
            return HandleExceptions(() =>
            {
                _dom = _browser.SearchAndFilterObjects<Microsoft.VisualStudio.TestTools.UITesting.HtmlControls.HtmlDocument>(new { ControlType = "Document" });
                var ctrl = new HtmlImage(_dom);
                if (_dom != null)
                {
                    _dom.WaitForControlReady();
                    if (id != string.Empty && src != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<HtmlImage>(new { Id = id, Src = src });
                    else if (src != string.Empty && alt != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<HtmlImage>(new { Src = src, Alt = alt });
                    else if (id != string.Empty && alt != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<HtmlImage>(new { Id = id, Alt = alt });
                    else if (id != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<HtmlImage>(new { Id = id });
                    else if (src != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<HtmlImage>(new { Src = src });
                    else if (alt != null)
                        ctrl = _dom.SearchAndFilterObjects<HtmlImage>(new { Alt = alt });
                    if (ctrl != null)
                    {
                        ctrl.WaitForControlReady();

                    }
                    else
                    {
                        Assert.Fail("LocateWebImgLink :: Control not loaded");

                    }
                }
                return ctrl;
            });
        }
        public HtmlImage LocateWebImgLinkAndClick(string id = "", string src = "", string alt = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebImgLink(id: id, src: src, alt: alt);
                if (ctrl != null)
                {
                    Mouse.Click(ctrl);
                }
                return ctrl;
            });
        }
        public HtmlImage LocateWebImgLinkAndHover(string id = "", string src = "", string alt = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebImgLink(id: id, src: src, alt: alt);
                if (ctrl != null)
                {
                    Mouse.Hover(ctrl);
                }
                return ctrl;
            });
        }

        public UITestControl LocateWebPopIframeImgLink(string pageid = "", string pageurl = "", string id = "", string src = "", string alt = "")
        {
            return HandleExceptions(() =>
            {
                var getDom = GetPopIframeDom(pageid: pageid, pageurl: pageurl);
                var ctrl = new HtmlImage(getDom);
                if (getDom != null)
                {
                    getDom.WaitForControlReady();
                    if (id != string.Empty && src != string.Empty)
                        ctrl = ctrl.SearchAndFilterObjects<HtmlImage>(new { Id = id, Src = src });
                    else if (src != string.Empty && alt != string.Empty)
                        ctrl = ctrl.SearchAndFilterObjects<HtmlImage>(new { Src = src, Alt = alt });
                    else if (id != string.Empty && alt != string.Empty)
                        ctrl = ctrl.SearchAndFilterObjects<HtmlImage>(new { Id = id, Alt = alt });
                    else if (id != string.Empty)
                        ctrl = ctrl.SearchAndFilterObjects<HtmlImage>(new { Id = id });
                    else if (src != string.Empty)
                        ctrl = ctrl.SearchAndFilterObjects<HtmlImage>(new { Src = src });
                    else if (alt != null)
                        ctrl = ctrl.SearchAndFilterObjects<HtmlImage>(new { Alt = alt });
                    if (ctrl != null)
                    {
                        ctrl.WaitForControlReady();

                    }
                    else
                    {
                        Assert.Fail("LocateWebPopIframeImgLink :: Control not loaded");

                    }
                }
                return ctrl;
            });
        }
        public UITestControl LocateWebPopIframeImgLinkAndClick(string pageid = "", string pageurl = "", string id = "", string src = "", string alt = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebPopIframeImgLink(pageid: pageid, pageurl: pageurl, id: id, src: src, alt: alt);
                if (ctrl != null)
                {
                    Mouse.Click(ctrl);
                }
                return ctrl;
            });
        }
        public UITestControl LocateWebPopIframeImgLinkAndHover(string pageid = "", string pageurl = "", string id = "", string src = "", string alt = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebPopIframeImgLink(pageid: pageid, pageurl: pageurl, id: id, src: src, alt: alt);
                if (ctrl != null)
                {
                    Mouse.Hover(ctrl);
                }
                return ctrl;
            });
        }

        public HtmlImage LocateWebPoppageImgLink(string id = "", string src = "", string alt = "", string innertext = "")
        {
            return HandleExceptions(() =>
            {
                var getDom = GetHtmlDocument();
                var ctrl = new HtmlImage(getDom);

                if (getDom != null)
                {
                    getDom.WaitForControlReady();
                    if (ctrl != null)
                    {
                        if (id != string.Empty)
                            ctrl.SearchProperties.Add(HtmlImage.PropertyNames.Id, id);
                        else if (src != string.Empty)
                            ctrl.SearchProperties.Add(HtmlImage.PropertyNames.Src, src);
                        else if (alt != string.Empty)
                            ctrl.SearchProperties.Add(HtmlImage.PropertyNames.Alt, alt);
                        else if (innertext != string.Empty)
                            ctrl.SearchProperties.Add(HtmlImage.PropertyNames.InnerText, innertext);
                        if (ctrl != null)
                        {
                            ctrl.WaitForControlReady();
                        }
                    }
                    else
                    {
                        Assert.Fail("LocateWebPoppageImgLink :: Control not loaded");

                    }
                }
                return ctrl;
            });
        }
        public HtmlImage LocateWebPoppageImgLinkAndClick(string id = "", string src = "", string alt = "", string innertext = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebPoppageImgLink(id: id, src: src, alt: alt, innertext: innertext);
                if (ctrl != null)
                {
                    Mouse.Click(ctrl);
                }
                return ctrl;
            });
        }
        public HtmlImage LocateWebPoppageImgLinkAndHover(string id = "", string src = "", string alt = "", string innertext = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebPoppageImgLink(id: id, src: src, alt: alt, innertext: innertext);
                if (ctrl != null)
                {
                    Mouse.Hover(ctrl);
                }
                return ctrl;
            });
        }

        public UITestControl LocateSharepointPopImage(string id = "", string src = "", string alt = "")
        {
            return HandleExceptions(() =>
            {
                var obj = new UITestControl(_browser);
                obj.TechnologyName = "Web";

                if (obj != null)
                {
                    if (id != string.Empty)
                        obj.SearchProperties.Add(HtmlImage.PropertyNames.Id, id);
                    else if (src != string.Empty)
                        obj.SearchProperties.Add(HtmlImage.PropertyNames.Src, src);
                    else if (alt != string.Empty)
                        obj.SearchProperties.Add(HtmlImage.PropertyNames.Alt, alt);
                    if (obj != null)
                    {
                        obj.WaitForControlReady();
                    }
                }
                else
                {
                    Assert.Fail("LocateSharepointPopImage :: Control not loaded");
                }
                return obj;
            });
        }
        public UITestControl LocateSharepointPopImageAndClick(string id = "", string src = "", string alt = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateSharepointPopImage(id: id, src: src, alt: alt);
                if (ctrl != null)
                {
                    Mouse.Click(ctrl);
                }
                return ctrl;
            });
        }
        public UITestControl LocateSharepointPopImageAndDoubleClick(string id = "", string src = "", string alt = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateSharepointPopImage(id: id, src: src, alt: alt);
                if (ctrl != null)
                {
                    Mouse.DoubleClick(ctrl);
                    Playback.Wait(1500);
                    Mouse.DoubleClick(ctrl);
                }
                return ctrl;
            });
        }
        public UITestControl LocateSharepointPopImageAndHover(string id = "", string src = "", string alt = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateSharepointPopImage(id: id, src: src, alt: alt);
                if (ctrl != null)
                {
                    Mouse.Hover(ctrl);
                }
                return ctrl;
            });
        }


        #endregion

        #region Locate Web HyperLinks partial Object and do the actions
        public HtmlHyperlink LocateWebLinkPartialObject(string href = "", string target = "", string innertext = "")
        {
            return HandleExceptions(() =>
            {
                var getDom = GetHtmlDocument();
                var ctrl = new HtmlHyperlink(getDom);

                if (getDom != null)
                {
                    getDom.WaitForControlReady();
                    if (innertext != string.Empty)
                        ctrl.SearchProperties.Add(HtmlHyperlink.PropertyNames.InnerText, innertext, PropertyExpressionOperator.Contains);
                    else if (href != string.Empty)
                        ctrl.SearchProperties.Add(HtmlHyperlink.PropertyNames.Href, href, PropertyExpressionOperator.Contains);
                    else if (target != string.Empty)
                        ctrl.SearchProperties.Add(HtmlHyperlink.PropertyNames.Target, target, PropertyExpressionOperator.Contains);
                    if (ctrl != null)
                    {
                        ctrl.WaitForControlReady();

                    }
                    else
                    {
                        Assert.Fail("LocateLocateWebLinkPartialObject :: Control not loaded");

                    }
                }
                return ctrl;
            });
        }
        public HtmlHyperlink LocateWebLinkPartialObjectAndClick(string href = "", string target = "", string innertext = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebLinkPartialObject(href: href, target: target, innertext: innertext);
                if (ctrl != null)
                {
                    Mouse.Click(ctrl);
                }
                return ctrl;
            });
        }
        public HtmlHyperlink LocateWebLinkPartialObjectAndHover(string href = "", string target = "", string innertext = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebLinkPartialObject(href: href, target: target, innertext: innertext);
                if (ctrl != null)
                {
                    Mouse.Hover(ctrl);
                }
                return ctrl;
            });
        }

        public UITestControl LocateSharepointPopLinkPartialObject(string href = "", string target = "", string innertext = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = new UITestControl(_browser);
                ctrl.TechnologyName = "Web";

                if (_browser != null)
                {
                    _browser.WaitForControlReady();
                    if (innertext != string.Empty)
                        ctrl.SearchProperties.Add(HtmlHyperlink.PropertyNames.InnerText, innertext, PropertyExpressionOperator.Contains);
                    else if (href != string.Empty)
                        ctrl.SearchProperties.Add(HtmlHyperlink.PropertyNames.Href, href, PropertyExpressionOperator.Contains);
                    else if (target != string.Empty)
                        ctrl.SearchProperties.Add(HtmlHyperlink.PropertyNames.Target, target, PropertyExpressionOperator.Contains);
                    if (ctrl != null)
                    {
                        ctrl.WaitForControlReady();

                    }
                    else
                    {
                        Assert.Fail("LocateSharepointPopLinkPartialObject :: Control not loaded");

                    }
                }
                return ctrl;
            });
        }
        public UITestControl LocateSharepointPopLinkPartialObjectAndClick(string href = "", string target = "", string innertext = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateSharepointPopLinkPartialObject(href: href, target: target, innertext: innertext);
                if (ctrl != null)
                {
                    Mouse.Click(ctrl);
                }
                return ctrl;
            });
        }
        public UITestControl LocateSharepointPopLinkPartialObjectAndHover(string href = "", string target = "", string innertext = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateSharepointPopLinkPartialObject(href: href, target: target, innertext: innertext);
                if (ctrl != null)
                {
                    Mouse.Hover(ctrl);
                }
                return ctrl;
            });
        }

        #endregion

        #region Locate Web Text Box, Text Area and do the Actions
        public HtmlEdit LocateWebTxtBox(string id = "", string name = "", string sclass = "", string innertext = "", string title = "")
        {
            return HandleExceptions(() =>
            {
                _dom = _browser.SearchAndFilterObjects<Microsoft.VisualStudio.TestTools.UITesting.HtmlControls.HtmlDocument>(new { ControlType = "Document" });
                var ctrl = new HtmlEdit(_dom);

                if (_dom != null)
                {
                    _dom.WaitForControlReady();
                    if (id != string.Empty && name != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<HtmlEdit>(new { Id = id, Name = name });
                    else if (id != string.Empty && sclass != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<HtmlEdit>(new { Id = id }, new { Class = sclass });
                    else if (name != string.Empty && sclass != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<HtmlEdit>(new { Name = name }, new { Class = sclass });
                    else if (id != string.Empty && title != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<HtmlEdit>(new { Id = id }, new { Title = title });
                    else if (id != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<HtmlEdit>(new { Id = id });
                    else if (name != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<HtmlEdit>(new { Name = name });
                    else if (innertext != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<HtmlEdit>(new { InnerText = innertext });
                    else if (title != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<HtmlEdit>(new { Title = title });
                    else if (sclass != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<HtmlEdit>(new { Class = name });
                    if (ctrl != null)
                    {
                        ctrl.WaitForControlReady();
                    }
                    else
                    {
                        Assert.Fail("LocateWebTxtBox :: Control not loaded");

                    }
                }
                return ctrl;
            });
        }
        public HtmlEdit LocateWebTxtBoxAndEnterTxt(string id = "", string name = "", string sclass = "", string innertext = "", string title = "", string value = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebTxtBox(id: id, name: name, sclass: sclass, innertext: innertext, title: title);
                if (ctrl != null)
                {
                    Mouse.Click(ctrl);
                    Keyboard.SendKeys(value);
                }
                return ctrl;
            });
        }
        public HtmlEdit LocateWebTxtBoxAndSendTxt(string id = "", string name = "", string sclass = "", string innertext = "", string title = "", string value = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebTxtBox(id: id, name: name, sclass: sclass, innertext: innertext, title: title);
                if (ctrl != null)
                {
                    Keyboard.SendKeys(value);
                }
                return ctrl;
            });
        }
        public HtmlEdit LocateWebTxtBoxAndEmpty(string id = "", string name = "", string sclass = "", string innertext = "", string title = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebTxtBox(id: id, name: name, sclass: sclass, innertext: innertext, title: title);
                if (ctrl != null)
                {
                    ctrl.Text = string.Empty;
                }
                return ctrl;
            });
        }
        public HtmlEdit LocateWebTxtBoxAndHover(string id = "", string name = "", string sclass = "", string innertext = "", string title = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebTxtBox(id: id, name: name, sclass: sclass, innertext: innertext, title: title);
                if (ctrl != null)
                {
                    Mouse.Hover(ctrl);
                }
                return ctrl;
            });
        }
        public string LocateWebTxtBoxAndGetTxt(string id = "", string name = "", string sclass = "", string innertext = "", string title = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebTxtBox(id: id, name: name, sclass: sclass, innertext: innertext, title: title);

                return ctrl.InnerText;
            });
        }

        public HtmlIFrame LocateWebIframeTxtBox(string id = "", string name = "", string sclass = "", string title = "")
        {
            return HandleExceptions(() =>
            {
                _dom = _browser.SearchAndFilterObjects<Microsoft.VisualStudio.TestTools.UITesting.HtmlControls.HtmlDocument>(new { ControlType = "Document" });
                var ctrl = new HtmlIFrame(_dom);

                if (_dom != null)
                {
                    _dom.WaitForControlReady();
                    if (id != string.Empty && name != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<HtmlIFrame>(new { Id = id, Name = name });
                    else if (id != string.Empty && sclass != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<HtmlIFrame>(new { Id = id }, new { Class = sclass });
                    else if (name != string.Empty && sclass != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<HtmlIFrame>(new { Name = name }, new { Class = sclass });
                    else if (id != string.Empty && title != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<HtmlIFrame>(new { Id = id }, new { Title = title });
                    else if (id != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<HtmlIFrame>(new { Id = id });
                    else if (name != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<HtmlIFrame>(new { Name = name });
                    else if (title != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<HtmlIFrame>(new { Title = title });
                    else if (sclass != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<HtmlIFrame>(new { Class = name });
                    if (ctrl != null)
                    {
                        ctrl.WaitForControlReady();
                    }
                    else
                    {
                        Assert.Fail("LocateWebIframeTxtBox :: Control not loaded");

                    }
                }
                return ctrl;
            });
        }
        public HtmlIFrame LocateWebIframeTxtBoxAndEnterTxt(string id = "", string name = "", string sclass = "", string title = "", string value = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebIframeTxtBox(id: id, name: name, sclass: sclass, title: title);
                if (ctrl != null)
                {
                    Mouse.Click(new Point(ctrl.BoundingRectangle.X + 50, ctrl.BoundingRectangle.Y + 14));
                    Keyboard.SendKeys(value);
                }
                return ctrl;
            });
        }
        public HtmlIFrame LocateWebIframeTxtBoxAndSendTxt(string id = "", string name = "", string sclass = "", string title = "", string value = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebIframeTxtBox(id: id, name: name, sclass: sclass, title: title);
                if (ctrl != null)
                {
                    Keyboard.SendKeys(value);
                }
                return ctrl;
            });
        }
        public HtmlIFrame LocateWebIframeTxtBoxAndEmpty(string id = "", string name = "", string sclass = "", string title = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebIframeTxtBox(id: id, name: name, sclass: sclass, title: title);
                if (ctrl != null)
                {
                    // need to find out what I can use here to make the 
                    //ctrl.InnerText = string.Empty;
                }
                return ctrl;
            });
        }
        public HtmlIFrame LocateWebIframeTxtBoxAndHover(string id = "", string name = "", string sclass = "", string title = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebIframeTxtBox(id: id, name: name, sclass: sclass, title: title);
                if (ctrl != null)
                {
                    Mouse.Hover(new Point(ctrl.BoundingRectangle.X + 50, ctrl.BoundingRectangle.Y + 14));
                }
                return ctrl;
            });
        }

        public UITestControl LocateSharepointPopIframeTxtBox(string id = "", string name = "", string sclass = "", string title = "")
        {
            return HandleExceptions(() =>
            {
                var obj = new UITestControl(_browser);
                obj.TechnologyName = "Web";

                if (obj != null)
                {
                    if (id != string.Empty)
                        obj.SearchProperties.Add(HtmlIFrame.PropertyNames.Id, id);
                    else if (name != string.Empty)
                        obj.SearchProperties.Add(HtmlIFrame.PropertyNames.Name, name);
                    else if (title != string.Empty)
                        obj.SearchProperties.Add(HtmlIFrame.PropertyNames.Title, title);
                    else if (sclass != string.Empty)
                        obj.SearchProperties.Add(HtmlIFrame.PropertyNames.Class, sclass);
                    if (obj != null)
                    {
                        obj.WaitForControlReady();
                    }
                }
                else
                {
                    Assert.Fail("LocateSharepointPopIframeTxtBox :: Control not loaded");
                }
                return obj;
            });
        }
        public UITestControl LocateSharepointPopIframeTxtBoxAndSendTxt(string id = "", string name = "", string sclass = "", string title = "", string value = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateSharepointPopIframeTxtBox(id: id, name: name, sclass: sclass, title: title);
                if (ctrl != null)
                {
                    Mouse.Click(new Point(ctrl.BoundingRectangle.X + 50, ctrl.BoundingRectangle.Y + 14));
                    Keyboard.SendKeys(value);
                }
                return ctrl;
            });
        }
        public UITestControl LocateSharepointPopIframeTxtBoxAndHover(string id = "", string name = "", string sclass = "", string title = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateSharepointPopIframeTxtBox(id: id, name: name, sclass: sclass, title: title);
                if (ctrl != null)
                {
                    Mouse.Hover(new Point(ctrl.BoundingRectangle.X + 50, ctrl.BoundingRectangle.Y + 14));
                }
                return ctrl;
            });
        }

        public HtmlEdit LocateWebPoppageTxtBox(string id = "", string name = "", string sclass = "", string title = "")
        {
            return HandleExceptions(() =>
            {
                var getDom = GetHtmlDocument();
                var ctrl = new HtmlEdit(getDom);

                if (getDom != null)
                {
                    getDom.WaitForControlReady();
                    if (id != string.Empty)
                        ctrl.SearchProperties.Add(HtmlEdit.PropertyNames.Id, id);
                    else if (name != string.Empty)
                        ctrl.SearchProperties.Add(HtmlEdit.PropertyNames.Name, name);
                    else if (sclass != string.Empty)
                        ctrl.SearchProperties.Add(HtmlEdit.PropertyNames.Class, sclass);
                    else if (title != string.Empty)
                        ctrl.SearchProperties.Add(HtmlEdit.PropertyNames.Title, title);
                    if (ctrl != null)
                    {
                        ctrl.WaitForControlReady();
                    }
                    else
                    {
                        Assert.Fail("LocateWebPoppageTxtBox :: Control not loaded");

                    }
                }
                return ctrl;
            });
        }
        public HtmlEdit LocateWebPoppageTxtBoxAndEnterTxt(string id = "", string name = "", string sclass = "", string title = "", string value = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebPoppageTxtBox(id: id, name: name, sclass: sclass, title: title);
                if (ctrl != null)
                {
                    Mouse.Click(ctrl);
                    Keyboard.SendKeys(value);
                }
                return ctrl;
            });
        }
        public HtmlEdit LocateWebPoppageTxtBoxAndSendTxt(string id = "", string name = "", string sclass = "", string title = "", string value = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebPoppageTxtBox(id: id, name: name, sclass: sclass, title: title);
                if (ctrl != null)
                {
                    Keyboard.SendKeys(value);
                }
                return ctrl;
            });
        }
        public HtmlEdit LocateWebPoppageTxtBoxAndHover(string id = "", string name = "", string sclass = "", string title = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebPoppageTxtBox(id: id, name: name, sclass: sclass, title: title);
                if (ctrl != null)
                {
                    Mouse.Hover(ctrl);
                }
                return ctrl;
            });
        }
        public HtmlEdit LocateWebPoppageTxtBoxAndEmpty(string id = "", string name = "", string sclass = "", string title = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebPoppageTxtBox(id: id, name: name, sclass: sclass, title: title);
                if (ctrl != null)
                {
                    ctrl.Text = string.Empty;
                }
                return ctrl;
            });
        }

        public UITestControl LocateSharepointPopTxtBox(string id = "", string name = "", string sclass = "", string title = "")
        {
            return HandleExceptions(() =>
            {
                var obj = new UITestControl(_browser);
                obj.TechnologyName = "Web";

                if (obj != null)
                {
                    if (id != string.Empty)
                        obj.SearchProperties.Add(HtmlEdit.PropertyNames.Id, id);
                    else if (name != string.Empty)
                        obj.SearchProperties.Add(HtmlEdit.PropertyNames.Name, name);
                    else if (title != string.Empty)
                        obj.SearchProperties.Add(HtmlEdit.PropertyNames.Title, title);
                    else if (sclass != string.Empty)
                        obj.SearchProperties.Add(HtmlEdit.PropertyNames.Class, sclass);
                    if (obj != null)
                    {
                        obj.WaitForControlReady();
                    }
                }
                else
                {
                    Assert.Fail("LocateSharepointPopTxtBox :: Control not loaded");
                }
                return obj;
            });
        }
        public UITestControl LocateSharepointPopTxtBoxAndSendTxt(string id = "", string name = "", string sclass = "", string title = "", string value = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateSharepointPopTxtBox(id: id, name: name, sclass: sclass, title: title);
                if (ctrl != null)
                {
                    ctrl.SetProperty(HtmlEdit.PropertyNames.Text, value);
                }
                return ctrl;
            });
        }
        public UITestControl LocateSharepointPopTxtBoxAndHover(string id = "", string name = "", string sclass = "", string title = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateSharepointPopTxtBox(id: id, name: name, sclass: sclass, title: title);
                if (ctrl != null)
                {
                    Mouse.Hover(ctrl);
                }
                return ctrl;
            });
        }

        public HtmlEdit LocateWebPopIframeTxtBox(string pageid = "", string pageurl = "", string id = "", string name = "", string sclass = "", string title = "")
        {
            return HandleExceptions(() =>
            {
                var getDom = GetPopIframeDom(pageid: pageid, pageurl: pageurl);
                var ctrl = new HtmlEdit(getDom);

                if (getDom != null)
                {
                    getDom.WaitForControlReady();
                    if (id != string.Empty && name != string.Empty)
                        ctrl = ctrl.SearchAndFilterObjects<HtmlEdit>(new { Id = id, Name = name });
                    else if (id != string.Empty && sclass != string.Empty)
                        ctrl = ctrl.SearchAndFilterObjects<HtmlEdit>(new { Id = id }, new { Class = sclass });
                    else if (name != string.Empty && sclass != string.Empty)
                        ctrl = ctrl.SearchAndFilterObjects<HtmlEdit>(new { Name = name }, new { Class = sclass });
                    else if (id != string.Empty && title != string.Empty)
                        ctrl = ctrl.SearchAndFilterObjects<HtmlEdit>(new { Id = id }, new { Title = title });
                    else if (id != string.Empty)
                        ctrl = ctrl.SearchAndFilterObjects<HtmlEdit>(new { Id = id });
                    else if (name != string.Empty)
                        ctrl = ctrl.SearchAndFilterObjects<HtmlEdit>(new { Name = name });
                    else if (title != string.Empty)
                        ctrl = ctrl.SearchAndFilterObjects<HtmlEdit>(new { Title = title });
                    else if (sclass != string.Empty)
                        ctrl = ctrl.SearchAndFilterObjects<HtmlEdit>(new { Class = name });
                    if (ctrl != null)
                    {
                        ctrl.WaitForControlReady();
                    }
                    else
                    {
                        Assert.Fail("LocateWebPopIframeTxtBox :: Control not loaded");

                    }
                }
                return ctrl;
            });
        }
        public UITestControl LocateWebPopIframeTxtBoxAndEnterTxt(string pageid = "", string pageurl = "", string id = "", string name = "", string sclass = "", string title = "", string value = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebPopIframeTxtBox(pageid: pageid, pageurl: pageurl, id: id, name: name, sclass: sclass, title: title);
                if (ctrl != null)
                {
                    Mouse.Click(ctrl);
                    Keyboard.SendKeys(value);
                }
                return ctrl;
            });
        }
        public UITestControl LocateWebPopIframeTxtBoxAndEmpty(string pageid = "", string pageurl = "", string id = "", string name = "", string sclass = "", string title = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebPopIframeTxtBox(pageid: pageid, pageurl: pageurl, id: id, name: name, sclass: sclass, title: title);
                if (ctrl != null)
                {
                    ctrl.Text = string.Empty;
                }
                return ctrl;
            });
        }
        public UITestControl LocateWebPopIframeTxtBoxAndHover(string pageid = "", string pageurl = "", string id = "", string name = "", string sclass = "", string title = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebPopIframeTxtBox(pageid: pageid, pageurl: pageurl, id: id, name: name, sclass: sclass, title: title);
                if (ctrl != null)
                {
                    Mouse.Hover(ctrl);
                }
                return ctrl;
            });
        }

        public HtmlTextArea LocateWebTxtAreaBox(string id = "", string name = "", string sclass = "", string title = "")
        {
            return HandleExceptions(() =>
            {
                _dom = _browser.SearchAndFilterObjects<Microsoft.VisualStudio.TestTools.UITesting.HtmlControls.HtmlDocument>(new { ControlType = "Document" });
                var ctrl = new HtmlTextArea(_dom);

                if (_dom != null)
                {
                    _dom.WaitForControlReady();
                    if (id != string.Empty && name != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<HtmlTextArea>(new { Id = id, Name = name });
                    else if (id != string.Empty && sclass != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<HtmlTextArea>(new { Id = id }, new { Class = sclass });
                    else if (name != string.Empty && sclass != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<HtmlTextArea>(new { Name = name }, new { Class = sclass });
                    else if (id != string.Empty && title != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<HtmlTextArea>(new { Id = id }, new { Title = title });
                    else if (id != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<HtmlTextArea>(new { Id = id });
                    else if (name != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<HtmlTextArea>(new { Name = name });
                    else if (title != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<HtmlTextArea>(new { Title = title });
                    else if (sclass != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<HtmlTextArea>(new { Class = sclass });

                    if (ctrl != null)
                    {
                        ctrl.WaitForControlReady();
                    }
                    else
                    {
                        Assert.Fail("LocateWebTxtAreaBox :: Control not loaded");

                    }
                }
                return ctrl;
            });
        }
        public HtmlTextArea LocateWebTxtAreaBoxAndHover(string id = "", string name = "", string sclass = "", string title = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebTxtAreaBox(id: id, name: name, sclass: sclass, title: title);
                if (ctrl != null)
                {
                    Mouse.Hover(ctrl);
                }
                return ctrl;
            });
        }
        public HtmlTextArea LocateWebTxtAreaBoxAndEnterTxt(string id = "", string name = "", string sclass = "", string title = "", string value = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebTxtAreaBox(id: id, name: name, sclass: sclass, title: title);
                if (ctrl != null)
                {
                    Mouse.Click(ctrl);
                    Keyboard.SendKeys(value);
                }
                return ctrl;
            });
        }
        public HtmlTextArea LocateWebTxtAreaBoxAndSendTxt(string id = "", string name = "", string sclass = "", string title = "", string value = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebTxtAreaBox(id: id, name: name, sclass: sclass, title: title);
                if (ctrl != null)
                {
                    Keyboard.SendKeys(value);
                }
                return ctrl;
            });
        }
        public HtmlTextArea LocateWebTxtAreaBoxAndEmpty(string id = "", string name = "", string sclass = "", string title = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebTxtAreaBox(id: id, name: name, sclass: sclass, title: title);
                if (ctrl != null)
                {
                    ctrl.Text = string.Empty;
                }
                return ctrl;
            });
        }
        public string LocateWebTxtAreaBoxAndGetTxt(string id = "", string name = "", string sclass = "", string title = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebTxtAreaBox(id: id, name: name, sclass: sclass, title: title);

                return ctrl.InnerText;
            });
        }

        public UITestControl LocateSharepointPopTxtAreaBox(string id = "", string name = "", string sclass = "", string title = "")
        {
            return HandleExceptions(() =>
            {
                var obj = new UITestControl(_browser);
                obj.TechnologyName = "Web";

                if (obj != null)
                {
                    if (id != string.Empty)
                        obj.SearchProperties.Add(HtmlTextArea.PropertyNames.Id, id);
                    else if (name != string.Empty)
                        obj.SearchProperties.Add(HtmlTextArea.PropertyNames.Name, name);
                    else if (title != string.Empty)
                        obj.SearchProperties.Add(HtmlTextArea.PropertyNames.Title, title);
                    else if (sclass != string.Empty)
                        obj.SearchProperties.Add(HtmlTextArea.PropertyNames.Class, sclass);
                    if (obj != null)
                    {
                        obj.WaitForControlReady();
                    }
                }
                else
                {
                    Assert.Fail("LocateSharepointPopTxtAreaBox :: Control not loaded");
                }
                return obj;
            });
        }
        public UITestControl LocateSharepointPopTxtAreaBoxAndSendTxt(string id = "", string name = "", string sclass = "", string title = "", string value = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateSharepointPopTxtAreaBox(id: id, name: name, sclass: sclass, title: title);
                if (ctrl != null)
                {
                    ctrl.SetProperty(HtmlTextArea.PropertyNames.Text, value);
                }
                return ctrl;
            });
        }
        public UITestControl LocateSharepointPopTxtAreaBoxAndHover(string id = "", string name = "", string sclass = "", string title = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateSharepointPopTxtAreaBox(id: id, name: name, sclass: sclass, title: title);
                if (ctrl != null)
                {
                    Mouse.Hover(ctrl);
                }
                return ctrl;
            });
        }

        public HtmlTextArea LocateWebPopIframeTxtAreaBox(string pageid = "", string pageurl = "", string id = "", string name = "", string sclass = "", string title = "")
        {
            return HandleExceptions(() =>
            {
                var getDom = GetPopIframeDom(pageid: pageid, pageurl: pageurl);
                var ctrl = new HtmlTextArea(getDom);

                if (getDom != null)
                {
                    getDom.WaitForControlReady();
                    if (id != string.Empty && name != string.Empty)
                        ctrl = ctrl.SearchAndFilterObjects<HtmlTextArea>(new { Id = id, Name = name });
                    else if (id != string.Empty && sclass != string.Empty)
                        ctrl = ctrl.SearchAndFilterObjects<HtmlTextArea>(new { Id = id }, new { Class = sclass });
                    else if (name != string.Empty && sclass != string.Empty)
                        ctrl = ctrl.SearchAndFilterObjects<HtmlTextArea>(new { Name = name }, new { Class = sclass });
                    else if (id != string.Empty && title != string.Empty)
                        ctrl = ctrl.SearchAndFilterObjects<HtmlTextArea>(new { Id = id }, new { Title = title });
                    else if (id != string.Empty)
                        ctrl = ctrl.SearchAndFilterObjects<HtmlTextArea>(new { Id = id });
                    else if (name != string.Empty)
                        ctrl = ctrl.SearchAndFilterObjects<HtmlTextArea>(new { Name = name });
                    else if (title != string.Empty)
                        ctrl = ctrl.SearchAndFilterObjects<HtmlTextArea>(new { Title = title });
                    else if (sclass != string.Empty)
                        ctrl = ctrl.SearchAndFilterObjects<HtmlTextArea>(new { Class = name });
                    if (ctrl != null)
                    {
                        ctrl.WaitForControlReady();
                    }
                    else
                    {
                        Assert.Fail("LocateWebPopIframeTxtAreaBox :: Control not loaded");

                    }
                }
                return ctrl;
            });
        }
        public HtmlTextArea LocateWebPopIframeTxtAreaBoxAndHover(string pageid = "", string pageurl = "", string id = "", string name = "", string sclass = "", string title = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebPopIframeTxtAreaBox(pageid: pageid, pageurl: pageurl, id: id, name: name, sclass: sclass, title: title);
                if (ctrl != null)
                {
                    Mouse.Hover(ctrl);
                }
                return ctrl;
            });
        }
        public HtmlTextArea LocateWebPopIframeTxtAreaBoxAndEnterTxt(string pageid = "", string pageurl = "", string id = "", string name = "", string sclass = "", string title = "", string value = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebPopIframeTxtAreaBox(pageid: pageid, pageurl: pageurl, id: id, name: name, sclass: sclass, title: title);
                if (ctrl != null)
                {
                    Mouse.Click(ctrl);
                    Keyboard.SendKeys(value);
                }
                return ctrl;
            });
        }
        public HtmlTextArea LocateWebPopIframeTxtAreaBoxAndSendTxt(string pageid = "", string pageurl = "", string id = "", string name = "", string sclass = "", string title = "", string value = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebPopIframeTxtAreaBox(pageid: pageid, pageurl: pageurl, id: id, name: name, sclass: sclass, title: title);
                if (ctrl != null)
                {
                    Keyboard.SendKeys(value);
                }
                return ctrl;
            });
        }
        public HtmlTextArea LocateWebPopIframeTxtAreaBoxAndEmpty(string pageid = "", string pageurl = "", string id = "", string name = "", string sclass = "", string title = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebPopIframeTxtAreaBox(pageid: pageid, pageurl: pageurl, id: id, name: name, sclass: sclass, title: title);
                if (ctrl != null)
                {
                    ctrl.Text = string.Empty;
                }
                return ctrl;
            });
        }

        public HtmlTextArea LocateWebPoppageTxtAreaBox(string id = "", string name = "", string sclass = "", string title = "")
        {
            return HandleExceptions(() =>
            {
                var getDom = GetHtmlDocument();
                var ctrl = new HtmlTextArea(getDom);

                if (getDom != null)
                {
                    getDom.WaitForControlReady();
                    if (id != string.Empty && name != string.Empty)
                        ctrl = ctrl.SearchAndFilterObjects<HtmlTextArea>(new { Id = id, Name = name });
                    else if (id != string.Empty && sclass != string.Empty)
                        ctrl = ctrl.SearchAndFilterObjects<HtmlTextArea>(new { Id = id }, new { Class = sclass });
                    else if (name != string.Empty && sclass != string.Empty)
                        ctrl = ctrl.SearchAndFilterObjects<HtmlTextArea>(new { Name = name }, new { Class = sclass });
                    else if (id != string.Empty && title != string.Empty)
                        ctrl = ctrl.SearchAndFilterObjects<HtmlTextArea>(new { Id = id }, new { Title = title });
                    else if (id != string.Empty)
                        ctrl = ctrl.SearchAndFilterObjects<HtmlTextArea>(new { Id = id });
                    else if (name != string.Empty)
                        ctrl = ctrl.SearchAndFilterObjects<HtmlTextArea>(new { Name = name });
                    else if (title != string.Empty)
                        ctrl = ctrl.SearchAndFilterObjects<HtmlTextArea>(new { Title = title });
                    else if (sclass != string.Empty)
                        ctrl = ctrl.SearchAndFilterObjects<HtmlTextArea>(new { Class = name });
                    if (ctrl != null)
                    {
                        ctrl.WaitForControlReady();
                    }
                    else
                    {
                        Assert.Fail("LocateWebPoppageTxtAreaBox :: Control not loaded");

                    }
                }
                return ctrl;
            });
        }
        public HtmlTextArea LocateWebPoppageTxtAreaBoxAndEnterTxt(string id = "", string name = "", string sclass = "", string title = "", string value = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebPoppageTxtAreaBox(id: id, name: name, sclass: sclass, title: title);
                if (ctrl != null)
                {
                    Mouse.Click(ctrl);
                    Keyboard.SendKeys(value);
                }
                return ctrl;
            });
        }
        public HtmlTextArea LocateWebPoppageTxtAreaBoxAndHover(string id = "", string name = "", string sclass = "", string title = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebPoppageTxtAreaBox(id: id, name: name, sclass: sclass, title: title);
                if (ctrl != null)
                {
                    Mouse.Hover(ctrl);
                }
                return ctrl;
            });
        }
        public HtmlTextArea LocateWebPoppageTxtAreaBoxAndEmpty(string id = "", string name = "", string sclass = "", string title = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebPoppageTxtAreaBox(id: id, name: name, sclass: sclass, title: title);
                if (ctrl != null)
                {
                    ctrl.Text = string.Empty;
                }
                return ctrl;
            });
        }

        public WinEdit LocateWebWinTxtBox(string id = "", string name = "", string sclass = "", string title = "")
        {
            return HandleExceptions(() =>
            {
                _dom = _browser.SearchAndFilterObjects<Microsoft.VisualStudio.TestTools.UITesting.HtmlControls.HtmlDocument>(new { ControlType = "Document" });
                var ctrl = new WinEdit(_dom);

                if (_dom != null)
                {
                    _dom.WaitForControlReady();
                    if (id != string.Empty && name != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<WinEdit>(new { Id = id, Name = name });
                    else if (id != string.Empty && sclass != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<WinEdit>(new { Id = id }, new { Class = sclass });
                    else if (name != string.Empty && sclass != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<WinEdit>(new { Name = name }, new { Class = sclass });
                    else if (id != string.Empty && title != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<WinEdit>(new { Id = id }, new { Title = title });
                    else if (id != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<WinEdit>(new { Id = id });
                    else if (name != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<WinEdit>(new { Name = name });
                    else if (title != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<WinEdit>(new { Title = title });
                    else if (sclass != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<WinEdit>(new { Class = sclass });

                    if (ctrl != null)
                    {
                        ctrl.WaitForControlReady();
                    }
                    else
                    {
                        Assert.Fail("LocateWebWinTxtBox :: Control not loaded");

                    }
                }
                return ctrl;
            });
        }
        public WinEdit LocateWebWinTxtBoxAndEnterTxt(string id = "", string name = "", string sclass = "", string title = "", string value = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebWinTxtBox(id: id, name: name, sclass: sclass, title: title);
                if (ctrl != null)
                {
                    Mouse.Click(ctrl);
                    Keyboard.SendKeys(value);
                }
                return ctrl;
            });
        }
        public WinEdit LocateWebWinTxtBoxAndSendTxt(string id = "", string name = "", string sclass = "", string title = "", string value = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebWinTxtBox(id: id, name: name, sclass: sclass, title: title);
                if (ctrl != null)
                {
                    Keyboard.SendKeys(value);
                }
                return ctrl;
            });
        }
        public WinEdit LocateWebWinTxtBoxAndEmpty(string id = "", string name = "", string sclass = "", string title = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebWinTxtBox(id: id, name: name, sclass: sclass, title: title);
                if (ctrl != null)
                {
                    ctrl.Text = string.Empty;
                }
                return ctrl;
            });
        }
        public WinEdit LocateWebWinTxtBoxAndHover(string id = "", string name = "", string sclass = "", string title = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebWinTxtBox(id: id, name: name, sclass: sclass, title: title);
                if (ctrl != null)
                {
                    Mouse.Hover(ctrl);
                }
                return ctrl;
            });
        }

        public HtmlEditableDiv LocateWebTableTxtBox(string id = "", string name = "", string sclass = "", string title = "")
        {
            return HandleExceptions(() =>
            {
                _dom = _browser.SearchAndFilterObjects<Microsoft.VisualStudio.TestTools.UITesting.HtmlControls.HtmlDocument>(new { ControlType = "Document" });
                var ctrl = new HtmlEditableDiv(_dom);

                if (_dom != null)
                {
                    _dom.WaitForControlReady();
                    if (id != string.Empty && name != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<HtmlEditableDiv>(new { Id = id, Name = name });
                    else if (id != string.Empty && sclass != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<HtmlEditableDiv>(new { Id = id }, new { Class = sclass });
                    else if (name != string.Empty && sclass != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<HtmlEditableDiv>(new { Name = name }, new { Class = sclass });
                    else if (id != string.Empty && title != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<HtmlEditableDiv>(new { Id = id }, new { Title = title });
                    else if (id != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<HtmlEditableDiv>(new { Id = id });
                    else if (name != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<HtmlEditableDiv>(new { Name = name });
                    else if (title != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<HtmlEditableDiv>(new { Title = title });
                    else if (sclass != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<HtmlEditableDiv>(new { Class = sclass });
                    if (ctrl != null)
                    {
                        ctrl.WaitForControlReady();
                        Mouse.Hover(ctrl);
                    }
                    else
                    {
                        Assert.Fail("LocateWebTableTxtBox :: Control not loaded");

                    }
                }
                return ctrl;
            });
        }
        public HtmlEditableDiv LocateWebTableTxtBoxAndEnterTxt(string id = "", string name = "", string sclass = "", string title = "", string value = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebTableTxtBox(id: id, name: name, sclass: sclass, title: title);
                if (ctrl != null)
                {
                    Mouse.Click(ctrl);
                    Keyboard.SendKeys(value);
                }
                return ctrl;
            });
        }
        public HtmlEditableDiv LocateWebTableTxtBoxAndSendTxt(string id = "", string name = "", string sclass = "", string title = "", string value = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebTableTxtBox(id: id, name: name, sclass: sclass, title: title);
                if (ctrl != null)
                {
                    Keyboard.SendKeys(value);
                }
                return ctrl;
            });
        }
        public HtmlEditableDiv LocateWebTableTxtBoxAndEmpty(string id = "", string name = "", string sclass = "", string title = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebTableTxtBox(id: id, name: name, sclass: sclass, title: title);
                if (ctrl != null)
                {
                    ctrl.Text = string.Empty;
                }
                return ctrl;
            });
        }
        public HtmlEditableDiv LocateWebTableTxtBoxAndHover(string id = "", string name = "", string sclass = "", string title = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebTableTxtBox(id: id, name: name, sclass: sclass, title: title);
                if (ctrl != null)
                {
                    Mouse.Hover(ctrl);
                }
                return ctrl;
            });
        }
        public string LocateWebTableTxtBoxAndGetTxt(string id = "", string name = "", string sclass = "", string title = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebTableTxtBox(id: id, name: name, sclass: sclass, title: title);

                return ctrl.InnerText;
            });
        }

        public UITestControl LocateSharepointPopTableTxtBox(string id = "", string name = "", string sclass = "", string title = "")
        {
            return HandleExceptions(() =>
            {
                var obj = new UITestControl(_browser);
                obj.TechnologyName = "Web";

                if (obj != null)
                {
                    if (id != string.Empty)
                        obj.SearchProperties.Add(HtmlEditableDiv.PropertyNames.Id, id);
                    else if (name != string.Empty)
                        obj.SearchProperties.Add(HtmlEditableDiv.PropertyNames.Name, name);
                    else if (title != string.Empty)
                        obj.SearchProperties.Add(HtmlEditableDiv.PropertyNames.Title, title);
                    else if (sclass != string.Empty)
                        obj.SearchProperties.Add(HtmlEditableDiv.PropertyNames.Class, sclass);
                    if (obj != null)
                    {
                        obj.WaitForControlReady();
                    }
                }
                else
                {
                    Assert.Fail("LocateSharepointPopTableTxtBox :: Control not loaded");
                }
                return obj;
            });
        }
        public UITestControl LocateSharepointPopTableTxtBoxAndSendTxt(string id = "", string name = "", string sclass = "", string title = "", string value = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateSharepointPopTableTxtBox(id: id, name: name, sclass: sclass, title: title);
                if (ctrl != null)
                {
                    ctrl.SetProperty(HtmlEditableDiv.PropertyNames.Text, value);
                }
                return ctrl;
            });
        }
        public UITestControl LocateSharepointPopTableTxtBoxAndHover(string id = "", string name = "", string sclass = "", string title = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateSharepointPopTableTxtBox(id: id, name: name, sclass: sclass, title: title);
                if (ctrl != null)
                {
                    Mouse.Hover(ctrl);
                }
                return ctrl;
            });
        }

        public HtmlEditableDiv LocateWebPopIframeTableTxtBox(string pageid = "", string pageurl = "", string id = "", string name = "", string sclass = "", string title = "")
        {
            return HandleExceptions(() =>
            {
                var getDom = GetPopIframeDom(pageid: pageid, pageurl: pageurl);
                var ctrl = new HtmlEditableDiv(getDom);

                if (getDom != null)
                {
                    getDom.WaitForControlReady();
                    if (id != string.Empty && name != string.Empty)
                        ctrl = ctrl.SearchAndFilterObjects<HtmlEditableDiv>(new { Id = id, Name = name });
                    else if (id != string.Empty && sclass != string.Empty)
                        ctrl = ctrl.SearchAndFilterObjects<HtmlEditableDiv>(new { Id = id }, new { Class = sclass });
                    else if (name != string.Empty && sclass != string.Empty)
                        ctrl = ctrl.SearchAndFilterObjects<HtmlEditableDiv>(new { Name = name }, new { Class = sclass });
                    else if (id != string.Empty && title != string.Empty)
                        ctrl = ctrl.SearchAndFilterObjects<HtmlEditableDiv>(new { Id = id }, new { Title = title });
                    else if (id != string.Empty)
                        ctrl = ctrl.SearchAndFilterObjects<HtmlEditableDiv>(new { Id = id });
                    else if (name != string.Empty)
                        ctrl = ctrl.SearchAndFilterObjects<HtmlEditableDiv>(new { Name = name });
                    else if (title != string.Empty)
                        ctrl = ctrl.SearchAndFilterObjects<HtmlEditableDiv>(new { Title = title });
                    else if (sclass != string.Empty)
                        ctrl = ctrl.SearchAndFilterObjects<HtmlEditableDiv>(new { Class = name });
                    if (ctrl != null)
                    {
                        ctrl.WaitForControlReady();
                    }
                    else
                    {
                        Assert.Fail("LocateWebPopIframeTableTxtBox :: Control not loaded");

                    }
                }
                return ctrl;
            });
        }
        public HtmlEditableDiv LocateWebPopIframeTableTxtBoxAndEnterTxt(string pageid = "", string pageurl = "", string id = "", string name = "", string sclass = "", string title = "", string value = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebPopIframeTableTxtBox(pageid: pageid, pageurl: pageurl, id: id, name: name, sclass: sclass, title: title);
                if (ctrl != null)
                {
                    Mouse.Click(ctrl);
                    Keyboard.SendKeys(value);
                }
                return ctrl;
            });
        }
        public HtmlEditableDiv LocateWebPopIframeTableTxtBoxAndSendTxt(string pageid = "", string pageurl = "", string id = "", string name = "", string sclass = "", string title = "", string value = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebPopIframeTableTxtBox(pageid: pageid, pageurl: pageurl, id: id, name: name, sclass: sclass, title: title);
                if (ctrl != null)
                {
                    Keyboard.SendKeys(value);
                }
                return ctrl;
            });
        }
        public HtmlEditableDiv LocateWebPopIframeTableTxtBoxAndEmpty(string pageid = "", string pageurl = "", string id = "", string name = "", string sclass = "", string title = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebPopIframeTableTxtBox(pageid: pageid, pageurl: pageurl, id: id, name: name, sclass: sclass, title: title);
                if (ctrl != null)
                {
                    ctrl.Text = string.Empty;
                }
                return ctrl;
            });
        }

        public HtmlEditableDiv LocateWebPoppageTableTxtBox(string id = "", string name = "", string sclass = "", string title = "")
        {
            return HandleExceptions(() =>
            {
                var getDom = GetHtmlDocument();
                var ctrl = new HtmlEditableDiv(getDom);

                if (getDom != null)
                {
                    getDom.WaitForControlReady();
                    if (id != string.Empty && name != string.Empty)
                        ctrl = ctrl.SearchAndFilterObjects<HtmlEditableDiv>(new { Id = id, Name = name });
                    else if (id != string.Empty && sclass != string.Empty)
                        ctrl = ctrl.SearchAndFilterObjects<HtmlEditableDiv>(new { Id = id }, new { Class = sclass });
                    else if (name != string.Empty && sclass != string.Empty)
                        ctrl = ctrl.SearchAndFilterObjects<HtmlEditableDiv>(new { Name = name }, new { Class = sclass });
                    else if (id != string.Empty && title != string.Empty)
                        ctrl = ctrl.SearchAndFilterObjects<HtmlEditableDiv>(new { Id = id }, new { Title = title });
                    else if (id != string.Empty)
                        ctrl = ctrl.SearchAndFilterObjects<HtmlEditableDiv>(new { Id = id });
                    else if (name != string.Empty)
                        ctrl = ctrl.SearchAndFilterObjects<HtmlEditableDiv>(new { Name = name });
                    else if (title != string.Empty)
                        ctrl = ctrl.SearchAndFilterObjects<HtmlEditableDiv>(new { Title = title });
                    else if (sclass != string.Empty)
                        ctrl = ctrl.SearchAndFilterObjects<HtmlEditableDiv>(new { Class = sclass });
                    if (ctrl != null)
                    {
                        ctrl.WaitForControlReady();
                        Mouse.Hover(ctrl);
                    }
                    else
                    {
                        Assert.Fail("LocateWebPoppageTableTxtBox :: Control not loaded");

                    }
                }
                return ctrl;
            });
        }
        public HtmlEditableDiv LocateWebPoppageTableTxtBoxAndEnterTxt(string id = "", string name = "", string sclass = "", string title = "", string value = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebPoppageTableTxtBox(id: id, name: name, sclass: sclass, title: title);
                if (ctrl != null)
                {
                    Mouse.Click(ctrl);
                    Keyboard.SendKeys(value);
                }
                return ctrl;
            });
        }
        public HtmlEditableDiv LocateWebPoppageTableTxtBoxAndEmpty(string id = "", string name = "", string sclass = "", string title = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebPoppageTableTxtBox(id: id, name: name, sclass: sclass, title: title);
                if (ctrl != null)
                {
                    ctrl.Text = string.Empty;
                }
                return ctrl;
            });
        }
        public HtmlEditableDiv LocateWebPoppageTableTxtBoxAndHover(string id = "", string name = "", string sclass = "", string title = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebPoppageTableTxtBox(id: id, name: name, sclass: sclass, title: title);
                if (ctrl != null)
                {
                    Mouse.Hover(ctrl);
                }
                return ctrl;
            });
        }
        public string LocateWebPoppageTableTxtBoxAndGetTxt(string id = "", string name = "", string sclass = "", string title = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebPoppageTableTxtBox(id: id, name: name, sclass: sclass, title: title);

                return ctrl.InnerText;
            });
        }
        #endregion

        #region Locate Web Combobox, List box and do the action
        public HtmlComboBox LocateWebComboBox(string id = "", string name = "", string sclass = "", string innertext = "", string type = "", string title = "")
        {
            return HandleExceptions(() =>
            {
                _dom = _browser.SearchAndFilterObjects<Microsoft.VisualStudio.TestTools.UITesting.HtmlControls.HtmlDocument>(new { ControlType = "Document" });
                var ctrl = new HtmlComboBox(_dom);

                if (_dom != null)
                {
                    _dom.WaitForControlReady();
                    if (id != string.Empty && name != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<HtmlComboBox>(new { Id = id, Name = name });
                    else if (id != string.Empty && sclass != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<HtmlComboBox>(new { Id = id }, new { Class = sclass });
                    else if (name != string.Empty && sclass != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<HtmlComboBox>(new { Name = name }, new { Class = sclass });
                    else if (id != string.Empty && title != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<HtmlComboBox>(new { Id = id }, new { Title = title });
                    else if (id != string.Empty && type != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<HtmlComboBox>(new { Id = id, Type = type });
                    else if (id != string.Empty && innertext != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<HtmlComboBox>(new { Id = id }, new { InnerText = innertext });
                    else if (id != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<HtmlComboBox>(new { Id = id });
                    else if (name != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<HtmlComboBox>(new { Name = name });
                    else if (sclass != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<HtmlComboBox>(new { Class = sclass });
                    else if (innertext != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<HtmlComboBox>(new { InnerText = innertext });
                    else if (type != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<HtmlComboBox>(new { Type = type });
                    else if (title != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<HtmlComboBox>(new { Title = title });
                    if (ctrl != null)
                    {
                        ctrl.WaitForControlReady();
                    }
                    else
                    {
                        Assert.Fail("LocateWebComboBox :: Control not loaded");

                    }
                }
                return ctrl;
            });
        }
        public HtmlComboBox LocateWebComboBoxAndSelect(string id = "", string name = "", string sclass = "", string innertext = "", string type = "", string title = "", string value = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebComboBox(id: id, name: name, sclass: sclass, innertext: innertext, type: type, title: title);
                if (ctrl != null)
                {
                    ctrl.SelectedItem = value;
                }
                return ctrl;
            });
        }
        public HtmlComboBox LocateWebComboBoxAndHover(string id = "", string name = "", string sclass = "", string innertext = "", string type = "", string title = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebComboBox(id: id, name: name, sclass: sclass, innertext: innertext, type: type, title: title);
                if (ctrl != null)
                {
                    Mouse.Hover(ctrl);
                }
                return ctrl;
            });
        }

        public HtmlComboBox LocateWebPopIframeComboBox(string pageid = "", string pageurl = "", string id = "", string name = "", string sclass = "", string innertext = "", string type = "", string title = "")
        {
            return HandleExceptions(() =>
            {
                var getDom = GetPopIframeDom(pageid: pageid, pageurl: pageurl);
                var ctrl = new HtmlComboBox(getDom);

                if (getDom != null)
                {
                    getDom.WaitForControlReady();
                    if (id != string.Empty && name != string.Empty)
                        ctrl = ctrl.SearchAndFilterObjects<HtmlComboBox>(new { Id = id, Name = name });
                    else if (id != string.Empty && sclass != string.Empty)
                        ctrl = ctrl.SearchAndFilterObjects<HtmlComboBox>(new { Id = id }, new { Class = sclass });
                    else if (name != string.Empty && sclass != string.Empty)
                        ctrl = ctrl.SearchAndFilterObjects<HtmlComboBox>(new { Name = name }, new { Class = sclass });
                    else if (id != string.Empty && title != string.Empty)
                        ctrl = ctrl.SearchAndFilterObjects<HtmlComboBox>(new { Id = id }, new { Title = title });
                    else if (id != string.Empty && type != string.Empty)
                        ctrl = ctrl.SearchAndFilterObjects<HtmlComboBox>(new { Id = id, Type = type });
                    else if (id != string.Empty && innertext != string.Empty)
                        ctrl = ctrl.SearchAndFilterObjects<HtmlComboBox>(new { Id = id }, new { InnerText = innertext });
                    else if (id != string.Empty)
                        ctrl = ctrl.SearchAndFilterObjects<HtmlComboBox>(new { Id = id });
                    else if (name != string.Empty)
                        ctrl = ctrl.SearchAndFilterObjects<HtmlComboBox>(new { Name = name });
                    else if (sclass != string.Empty)
                        ctrl = ctrl.SearchAndFilterObjects<HtmlComboBox>(new { Class = sclass });
                    else if (innertext != string.Empty)
                        ctrl = ctrl.SearchAndFilterObjects<HtmlComboBox>(new { InnerText = innertext });
                    else if (type != string.Empty)
                        ctrl = ctrl.SearchAndFilterObjects<HtmlComboBox>(new { Type = type });
                    else if (title != string.Empty)
                        ctrl = ctrl.SearchAndFilterObjects<HtmlComboBox>(new { Title = title });
                    if (ctrl != null)
                    {
                        ctrl.WaitForControlReady();
                    }
                    else
                    {
                        Assert.Fail("LocateWebPopIframeComboBox :: Control not loaded");

                    }
                }
                return ctrl;
            });
        }
        public HtmlComboBox LocateWebPopIframeComboBoxAndSelect(string pageid = "", string pageurl = "", string id = "", string name = "", string sclass = "", string innertext = "", string type = "", string title = "", string value = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebPopIframeComboBox(pageid: pageid, pageurl: pageurl, id: id, name: name, sclass: sclass, innertext: innertext, type: type, title: title);
                if (ctrl != null)
                {
                    ctrl.SelectedItem = value;
                }
                return ctrl;
            });
        }
        public HtmlComboBox LocateWebPopIframeComboBoxAndHover(string pageid = "", string pageurl = "", string id = "", string name = "", string sclass = "", string innertext = "", string type = "", string title = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebPopIframeComboBox(pageid: pageid, pageurl: pageurl, id: id, name: name, sclass: sclass, innertext: innertext, type: type, title: title);
                if (ctrl != null)
                {
                    Mouse.Hover(ctrl);
                }
                return ctrl;
            });
        }

        public UITestControl LocateSharepointPopComboBox(string id = "", string name = "", string sclass = "", string innertext = "", string title = "")
        {
            return HandleExceptions(() =>
            {
                var obj = new UITestControl(_browser);
                obj.TechnologyName = "Web";

                if (obj != null)
                {
                    if (id != string.Empty)
                        obj.SearchProperties.Add(HtmlComboBox.PropertyNames.Id, id);
                    else if (name != string.Empty)
                        obj.SearchProperties.Add(HtmlComboBox.PropertyNames.Name, name);
                    else if (title != string.Empty)
                        obj.SearchProperties.Add(HtmlComboBox.PropertyNames.Title, title);
                    else if (sclass != string.Empty)
                        obj.SearchProperties.Add(HtmlComboBox.PropertyNames.Class, sclass);
                    if (obj != null)
                    {
                        obj.WaitForControlReady();
                    }
                }
                else
                {
                    Assert.Fail("LocateSharepointPopComboBox :: Control not loaded");
                }
                return obj;
            });
        }
        public UITestControl LocateSharepointPopComboBoxAndSelect(string id = "", string name = "", string sclass = "", string title = "", string value = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateSharepointPopComboBox(id: id, name: name, sclass: sclass, title: title);
                if (ctrl != null)
                {
                    ctrl.SetProperty(HtmlComboBox.PropertyNames.SelectedItem, value);
                }
                return ctrl;
            });
        }
        public UITestControl LocateSharepointPopComboBoxAndHover(string id = "", string name = "", string sclass = "", string title = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateSharepointPopComboBox(id: id, name: name, sclass: sclass, title: title);
                if (ctrl != null)
                {
                    Mouse.Hover(ctrl);
                }
                return ctrl;
            });
        }

        public HtmlComboBox LocateWebPoppageComboBox(string id = "", string name = "", string sclass = "", string innertext = "", string title = "")
        {
            return HandleExceptions(() =>
            {
                var getDom = GetHtmlDocument();
                var ctrl = new HtmlComboBox(getDom);

                if (getDom != null)
                {
                    getDom.WaitForControlReady();
                    if (id != string.Empty)
                        ctrl.SearchProperties.Add(HtmlComboBox.PropertyNames.Id, id);
                    else if (name != string.Empty)
                        ctrl.SearchProperties.Add(HtmlComboBox.PropertyNames.Name, name);
                    else if (sclass != string.Empty)
                        ctrl.SearchProperties.Add(HtmlComboBox.PropertyNames.Class, sclass);
                    else if (innertext != string.Empty)
                        ctrl.SearchProperties.Add(HtmlComboBox.PropertyNames.InnerText, innertext);
                    else if (title != string.Empty)
                        ctrl.SearchProperties.Add(HtmlComboBox.PropertyNames.Title, title);
                    if (ctrl != null)
                    {
                        ctrl.WaitForControlReady();
                    }
                    else
                    {
                        Assert.Fail("LocateWebPoppageComboBox :: Control not loaded");

                    }
                }
                return ctrl;
            });
        }
        public HtmlComboBox LocateWebPoppageComboBoxAndSelect(string id = "", string name = "", string sclass = "", string innertext = "", string title = "", string value = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebPoppageComboBox(id: id, name: name, sclass: sclass, innertext: innertext, title: title);
                if (ctrl != null)
                {
                    ctrl.SelectedItem = value;
                }
                return ctrl;
            });
        }
        public HtmlComboBox LocateWebPoppageComboBoxAndHover(string id = "", string name = "", string sclass = "", string innertext = "", string title = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebPoppageComboBox(id: id, name: name, sclass: sclass, innertext: innertext, title: title);
                if (ctrl != null)
                {
                    Mouse.Hover(ctrl);
                }
                return ctrl;
            });
        }

        public HtmlList LocateWebListBox(string id = "", string name = "", string sclass = "", string innertext = "", string type = "", string title = "")
        {
            return HandleExceptions(() =>
            {
                _dom = _browser.SearchAndFilterObjects<Microsoft.VisualStudio.TestTools.UITesting.HtmlControls.HtmlDocument>(new { ControlType = "Document" });
                var ctrl = new HtmlList(_dom);

                if (_dom != null)
                {
                    _dom.WaitForControlReady();
                    if (id != string.Empty && name != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<HtmlList>(new { Id = id, Name = name });
                    else if (id != string.Empty && sclass != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<HtmlList>(new { Id = id }, new { Class = sclass });
                    else if (name != string.Empty && sclass != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<HtmlList>(new { Name = name }, new { Class = sclass });
                    else if (id != string.Empty && title != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<HtmlList>(new { Id = id }, new { Title = title });
                    else if (id != string.Empty && type != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<HtmlList>(new { Id = id, Type = type });
                    else if (id != string.Empty && innertext != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<HtmlList>(new { Id = id }, new { InnerText = innertext });
                    else if (id != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<HtmlList>(new { Id = id });
                    else if (name != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<HtmlList>(new { Name = name });
                    else if (sclass != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<HtmlList>(new { Class = sclass });
                    else if (innertext != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<HtmlList>(new { InnerText = innertext });
                    else if (type != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<HtmlList>(new { Type = type });
                    else if (title != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<HtmlList>(new { Title = title });
                    if (ctrl != null)
                    {
                        ctrl.WaitForControlReady();
                    }
                    else
                    {
                        Assert.Fail("LocateWebListBox :: Control not loaded");

                    }
                }
                return ctrl;
            });
        }
        public HtmlList LocateWebListBoxAndSelect(string id = "", string name = "", string sclass = "", string innertext = "", string type = "", string title = "", string value = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebListBox(id: id, name: name, sclass: sclass, innertext: innertext, type: type, title: title);
                if (ctrl != null)
                {
                    ctrl.SelectedItemsAsString = value;
                }
                return ctrl;
            });
        }
        public HtmlList LocateWebListBoxAndHover(string id = "", string name = "", string sclass = "", string innertext = "", string type = "", string title = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebListBox(id: id, name: name, sclass: sclass, innertext: innertext, type: type, title: title);
                if (ctrl != null)
                {
                    Mouse.Hover(ctrl);
                }
                return ctrl;
            });
        }

        public HtmlList LocateWebPopIframeListBox(string pageid = "", string pageurl = "", string id = "", string name = "", string sclass = "", string innertext = "", string type = "", string title = "")
        {
            return HandleExceptions(() =>
            {
                var getDom = GetPopIframeDom(pageid: pageid, pageurl: pageurl);
                var ctrl = new HtmlList(getDom);

                if (getDom != null)
                {
                    getDom.WaitForControlReady();
                    if (id != string.Empty && name != string.Empty)
                        ctrl = ctrl.SearchAndFilterObjects<HtmlList>(new { Id = id, Name = name });
                    else if (id != string.Empty && sclass != string.Empty)
                        ctrl = ctrl.SearchAndFilterObjects<HtmlList>(new { Id = id }, new { Class = sclass });
                    else if (name != string.Empty && sclass != string.Empty)
                        ctrl = ctrl.SearchAndFilterObjects<HtmlList>(new { Name = name }, new { Class = sclass });
                    else if (id != string.Empty && title != string.Empty)
                        ctrl = ctrl.SearchAndFilterObjects<HtmlList>(new { Id = id }, new { Title = title });
                    else if (id != string.Empty && type != string.Empty)
                        ctrl = ctrl.SearchAndFilterObjects<HtmlList>(new { Id = id, Type = type });
                    else if (id != string.Empty && innertext != string.Empty)
                        ctrl = ctrl.SearchAndFilterObjects<HtmlList>(new { Id = id }, new { InnerText = innertext });
                    else if (id != string.Empty)
                        ctrl = ctrl.SearchAndFilterObjects<HtmlList>(new { Id = id });
                    else if (name != string.Empty)
                        ctrl = ctrl.SearchAndFilterObjects<HtmlList>(new { Name = name });
                    else if (sclass != string.Empty)
                        ctrl = ctrl.SearchAndFilterObjects<HtmlList>(new { Class = sclass });
                    else if (innertext != string.Empty)
                        ctrl = ctrl.SearchAndFilterObjects<HtmlList>(new { InnerText = innertext });
                    else if (type != string.Empty)
                        ctrl = ctrl.SearchAndFilterObjects<HtmlList>(new { Type = type });
                    else if (title != string.Empty)
                        ctrl = ctrl.SearchAndFilterObjects<HtmlList>(new { Title = title });
                    if (ctrl != null)
                    {
                        ctrl.WaitForControlReady();
                    }
                    else
                    {
                        Assert.Fail("LocateWebPopIframeListBox :: Control not loaded");

                    }
                }
                return ctrl;
            });
        }
        public HtmlList LocateWebPopIframeListBoxAndSelect(string pageid = "", string pageurl = "", string id = "", string name = "", string sclass = "", string innertext = "", string type = "", string title = "", string value = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebPopIframeListBox(pageid: pageid, pageurl: pageurl, id: id, name: name, sclass: sclass, innertext: innertext, type: type, title: title);
                if (ctrl != null)
                {
                    ctrl.SelectedItemsAsString = value;
                }
                return ctrl;
            });
        }
        public HtmlList LocateWebPopIframeListBoxAndHover(string pageid = "", string pageurl = "", string id = "", string name = "", string sclass = "", string innertext = "", string type = "", string title = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebPopIframeListBox(pageid: pageid, pageurl: pageurl, id: id, name: name, sclass: sclass, innertext: innertext, type: type, title: title);
                if (ctrl != null)
                {
                    Mouse.Hover(ctrl);
                }
                return ctrl;
            });
        }

        public UITestControl LocateSharepointPopListBox(string id = "", string name = "", string sclass = "", string innertext = "", string title = "")
        {
            return HandleExceptions(() =>
            {
                var obj = new UITestControl(_browser);
                obj.TechnologyName = "Web";

                if (obj != null)
                {
                    if (id != string.Empty)
                        obj.SearchProperties.Add(HtmlList.PropertyNames.Id, id);
                    else if (name != string.Empty)
                        obj.SearchProperties.Add(HtmlList.PropertyNames.Name, name);
                    else if (title != string.Empty)
                        obj.SearchProperties.Add(HtmlList.PropertyNames.Title, title);
                    else if (sclass != string.Empty)
                        obj.SearchProperties.Add(HtmlList.PropertyNames.Class, sclass);
                    if (obj != null)
                    {
                        obj.WaitForControlReady();
                    }
                }
                else
                {
                    Assert.Fail("LocateSharepointPopListBox :: Control not loaded");
                }
                return obj;
            });
        }
        public UITestControl LocateSharepointPopListBoxAndSelect(string id = "", string name = "", string sclass = "", string title = "", string value = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateSharepointPopListBox(id: id, name: name, sclass: sclass, title: title);
                if (ctrl != null)
                {
                    ctrl.SetProperty(HtmlList.PropertyNames.SelectedItemsAsString, value);
                }
                return ctrl;
            });
        }
        public UITestControl LocateSharepointPopListBoxAndHover(string id = "", string name = "", string sclass = "", string title = "", string value = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateSharepointPopListBox(id: id, name: name, sclass: sclass, title: title);
                if (ctrl != null)
                {
                    Mouse.Hover(ctrl);
                }
                return ctrl;
            });
        }

        public HtmlList LocateWebPoppageListBox(string id = "", string name = "", string sclass = "", string innertext = "", string title = "")
        {
            return HandleExceptions(() =>
            {
                var getDom = GetHtmlDocument();
                var ctrl = new HtmlList(getDom);

                if (getDom != null)
                {
                    getDom.WaitForControlReady();
                    if (id != string.Empty)
                        ctrl.SearchProperties.Add(HtmlList.PropertyNames.Id, id);
                    else if (name != string.Empty)
                        ctrl.SearchProperties.Add(HtmlList.PropertyNames.Name, name);
                    else if (sclass != string.Empty)
                        ctrl.SearchProperties.Add(HtmlList.PropertyNames.Class, sclass);
                    else if (innertext != string.Empty)
                        ctrl.SearchProperties.Add(HtmlList.PropertyNames.InnerText, innertext);
                    else if (title != string.Empty)
                        ctrl.SearchProperties.Add(HtmlList.PropertyNames.Title, title);
                    if (ctrl != null)
                    {
                        ctrl.WaitForControlReady();
                    }
                    else
                    {
                        Assert.Fail("LocateWebPoppageListBox :: Control not loaded");

                    }
                }
                return ctrl;
            });
        }
        public HtmlList LocateWebPoppageListBoxAndSelect(string id = "", string name = "", string sclass = "", string innertext = "", string title = "", string value = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebPoppageListBox(id: id, name: name, sclass: sclass, innertext: innertext, title: title);
                if (ctrl != null)
                {
                    ctrl.SelectedItemsAsString = value;
                }
                return ctrl;
            });
        }
        public HtmlList LocateWebPoppageListBoxAndHover(string id = "", string name = "", string sclass = "", string innertext = "", string title = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebPoppageListBox(id: id, name: name, sclass: sclass, innertext: innertext, title: title);
                if (ctrl != null)
                {
                    Mouse.Hover(ctrl);
                }
                return ctrl;
            });
        }
        #endregion

        #region combo box partila text
        public HtmlComboBox LocateWebComboBoxAndSelectPartialTxt(string id = "", string name = "", string sclass = "", string innertext = "", string type = "", string title = "", string value = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebComboBox(id: id, name: name, sclass: sclass, innertext: innertext, type: type, title: title);
                if (ctrl != null)
                {
                    foreach (var item in ctrl.Items)
                    {
                        string itemtext = item.GetProperty("DisplayText").ToString();
                        if (itemtext.Contains(value))
                        {
                            ctrl.SelectedItem = itemtext;
                            break;
                        }
                    }
                }
                return ctrl;
            });
        }
        public HtmlList LocateWebListBoxAndSelectPartialTxt(string id = "", string name = "", string sclass = "", string innertext = "", string type = "", string title = "", string value = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebListBox(id: id, name: name, sclass: sclass, innertext: innertext, type: type, title: title);
                if (ctrl != null)
                {
                    foreach (var item in ctrl.Items)
                    {
                        string itemtext = item.GetProperty("DisplayText").ToString();
                        if (itemtext.Contains(value))
                        {
                            ctrl.SelectedItemsAsString = itemtext;
                            break;
                        }
                    }
                }
                return ctrl;
            });
        }
        public HtmlList LocateWebPoppageListBoxAndSelectPartialTxt(string id = "", string name = "", string sclass = "", string innertext = "", string type = "", string title = "", string value = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebPoppageListBox(id: id, name: name, sclass: sclass, innertext: innertext, title: title);
                if (ctrl != null)
                {
                    foreach (var item in ctrl.Items)
                    {
                        string itemtext = item.GetProperty("DisplayText").ToString();
                        if (itemtext.Contains(value))
                        {
                            ctrl.SelectedItemsAsString = itemtext;
                            break;
                        }
                    }
                }
                return ctrl;
            });
        }
        #endregion

        #region Locate Web Check box, Radio Button and do the action
        public HtmlCheckBox LocateWebCheckBox(string id = "", string name = "", string sclass = "", string innertext = "", string title = "")
        {
            return HandleExceptions(() =>
            {
                _dom = _browser.SearchAndFilterObjects<Microsoft.VisualStudio.TestTools.UITesting.HtmlControls.HtmlDocument>(new { ControlType = "Document" });
                var ctrl = new HtmlCheckBox(_dom);

                if (_dom != null)
                {
                    _dom.WaitForControlReady();
                    if (id != string.Empty && name != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<HtmlCheckBox>(new { Id = id, Name = name });
                    else if (id != string.Empty && sclass != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<HtmlCheckBox>(new { Id = id }, new { Class = sclass });
                    else if (name != string.Empty && sclass != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<HtmlCheckBox>(new { Name = name }, new { Class = sclass });
                    else if (id != string.Empty && title != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<HtmlCheckBox>(new { Id = id }, new { Title = title });
                    else if (id != string.Empty && innertext != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<HtmlCheckBox>(new { Id = id }, new { InnerText = innertext });
                    else if (id != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<HtmlCheckBox>(new { Id = id });
                    else if (name != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<HtmlCheckBox>(new { Name = name });
                    else if (sclass != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<HtmlCheckBox>(new { Class = sclass });
                    else if (innertext != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<HtmlCheckBox>(new { InnerText = innertext });
                    else if (title != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<HtmlCheckBox>(new { Title = title });
                    if (ctrl != null)
                    {
                        ctrl.WaitForControlReady();
                    }
                    else
                    {
                        Assert.Fail("LocateWebCheckBox :: Control not loaded");

                    }
                }
                return ctrl;
            });
        }
        public HtmlCheckBox LocateWebCheckBoxAndHover(string id = "", string name = "", string sclass = "", string innertext = "", string title = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebCheckBox(id: id, name: name, sclass: sclass, innertext: innertext, title: title);
                if (ctrl != null)
                {
                    Mouse.Hover(ctrl);
                }
                return ctrl;
            });
        }
        public HtmlCheckBox LocateWebCheckBoxAndChecked(string id = "", string name = "", string sclass = "", string innertext = "", string title = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebCheckBox(id: id, name: name, sclass: sclass, innertext: innertext, title: title);
                if (ctrl != null)
                {
                    ctrl.Checked = true;
                }
                return ctrl;
            });
        }
        public HtmlCheckBox LocateWebCheckBoxAndUnChecked(string id = "", string name = "", string sclass = "", string innertext = "", string title = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebCheckBox(id: id, name: name, sclass: sclass, innertext: innertext, title: title);
                if (ctrl != null)
                {
                    ctrl.Checked = false;
                }
                return ctrl;
            });
        }

        public HtmlCheckBox LocateWebPopIframeCheckBox(string pageid = "", string pageurl = "", string id = "", string name = "", string sclass = "", string innertext = "", string title = "")
        {
            return HandleExceptions(() =>
            {
                var getDom = GetPopIframeDom(pageid: pageid, pageurl: pageurl);
                var ctrl = new HtmlCheckBox(getDom);

                if (getDom != null)
                {
                    getDom.WaitForControlReady();
                    if (id != string.Empty && name != string.Empty)
                        ctrl = ctrl.SearchAndFilterObjects<HtmlCheckBox>(new { Id = id, Name = name });
                    else if (id != string.Empty && sclass != string.Empty)
                        ctrl = ctrl.SearchAndFilterObjects<HtmlCheckBox>(new { Id = id }, new { Class = sclass });
                    else if (name != string.Empty && sclass != string.Empty)
                        ctrl = ctrl.SearchAndFilterObjects<HtmlCheckBox>(new { Name = name }, new { Class = sclass });
                    else if (id != string.Empty && title != string.Empty)
                        ctrl = ctrl.SearchAndFilterObjects<HtmlCheckBox>(new { Id = id }, new { Title = title });
                    else if (id != string.Empty && innertext != string.Empty)
                        ctrl = ctrl.SearchAndFilterObjects<HtmlCheckBox>(new { Id = id }, new { InnerText = innertext });
                    else if (id != string.Empty)
                        ctrl = ctrl.SearchAndFilterObjects<HtmlCheckBox>(new { Id = id });
                    else if (name != string.Empty)
                        ctrl = ctrl.SearchAndFilterObjects<HtmlCheckBox>(new { Name = name });
                    else if (sclass != string.Empty)
                        ctrl = ctrl.SearchAndFilterObjects<HtmlCheckBox>(new { Class = sclass });
                    else if (innertext != string.Empty)
                        ctrl = ctrl.SearchAndFilterObjects<HtmlCheckBox>(new { InnerText = innertext });
                    else if (title != string.Empty)
                        ctrl = ctrl.SearchAndFilterObjects<HtmlCheckBox>(new { Title = title });
                    if (ctrl != null)
                    {
                        ctrl.WaitForControlReady();
                    }
                    else
                    {
                        Assert.Fail("LocateWebPopIframeCheckBox :: Control not loaded");

                    }
                }
                return ctrl;
            });
        }
        public HtmlCheckBox LocateWebPopIframeCheckBoxAndChecked(string pageid = "", string pageurl = "", string id = "", string name = "", string sclass = "", string innertext = "", string title = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebPopIframeCheckBox(pageid: pageid, pageurl: pageurl, id: id, name: name, sclass: sclass, innertext: innertext, title: title);
                if (ctrl != null)
                {
                    ctrl.Checked = true;
                }
                return ctrl;
            });
        }
        public HtmlCheckBox LocateWebPopIframeCheckBoxAndUnChecked(string pageid = "", string pageurl = "", string id = "", string name = "", string sclass = "", string innertext = "", string title = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebPopIframeCheckBox(pageid: pageid, pageurl: pageurl, id: id, name: name, sclass: sclass, innertext: innertext, title: title);
                if (ctrl != null)
                {
                    ctrl.Checked = false;
                }
                return ctrl;
            });
        }
        public HtmlCheckBox LocateWebPopIframeCheckBoxAndHover(string pageid = "", string pageurl = "", string id = "", string name = "", string sclass = "", string innertext = "", string title = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebPopIframeCheckBox(pageid: pageid, pageurl: pageurl, id: id, name: name, sclass: sclass, innertext: innertext, title: title);
                if (ctrl != null)
                {
                    Mouse.Hover(ctrl);
                }
                return ctrl;
            });
        }

        public UITestControl LocateSharepointPopCheckBox(string id = "", string name = "", string sclass = "", string innertext = "", string title = "")
        {
            return HandleExceptions(() =>
            {
                var obj = new UITestControl(_browser);
                obj.TechnologyName = "Web";

                if (obj != null)
                {
                    if (id != string.Empty)
                        obj.SearchProperties.Add(HtmlCheckBox.PropertyNames.Id, id);
                    else if (name != string.Empty)
                        obj.SearchProperties.Add(HtmlCheckBox.PropertyNames.Name, name);
                    else if (title != string.Empty)
                        obj.SearchProperties.Add(HtmlCheckBox.PropertyNames.Title, title);
                    else if (sclass != string.Empty)
                        obj.SearchProperties.Add(HtmlCheckBox.PropertyNames.Class, sclass);
                    else if (innertext != string.Empty)
                        obj.SearchProperties.Add(HtmlCheckBox.PropertyNames.InnerText, innertext);
                    else if (title != string.Empty)
                        obj.SearchProperties.Add(HtmlCheckBox.PropertyNames.Title, title);
                    if (obj != null)
                    {
                        obj.WaitForControlReady();
                    }
                }
                else
                {
                    Assert.Fail("LocateSharepointPopCheckBox :: Control not loaded");
                }
                return obj;
            });
        }
        public UITestControl LocateSharepointPopCheckBoxAndHover(string id = "", string name = "", string sclass = "", string innertext = "", string title = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateSharepointPopComboBox(id: id, name: name, sclass: sclass, innertext: innertext, title: title);
                if (ctrl != null)
                {
                    Mouse.Hover(ctrl);
                }
                return ctrl;
            });
        }
        public UITestControl LocateSharepointPopCheckBoxAndChecked(string id = "", string name = "", string sclass = "", string innertext = "", string title = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateSharepointPopComboBox(id: id, name: name, sclass: sclass, innertext: innertext, title: title);
                if (ctrl != null)
                {
                    ctrl.SetProperty(HtmlCheckBox.PropertyNames.Checked, true);
                }
                return ctrl;
            });
        }
        public UITestControl LocateSharepointPopCheckBoxAndUnChecked(string id = "", string name = "", string sclass = "", string innertext = "", string title = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateSharepointPopComboBox(id: id, name: name, sclass: sclass, innertext: innertext, title: title);
                if (ctrl != null)
                {
                    ctrl.SetProperty(HtmlCheckBox.PropertyNames.Checked, false);
                }
                return ctrl;
            });
        }

        public HtmlCheckBox LocateWebPoppageCheckBox(string id = "", string name = "", string sclass = "", string innertext = "", string title = "")
        {
            return HandleExceptions(() =>
            {
                var getDom = GetHtmlDocument();
                var ctrl = new HtmlCheckBox(getDom);

                if (getDom != null)
                {
                    getDom.WaitForControlReady();
                    if (id != string.Empty)
                        ctrl.SearchProperties.Add(HtmlCheckBox.PropertyNames.Id, id);
                    else if (name != string.Empty)
                        ctrl.SearchProperties.Add(HtmlCheckBox.PropertyNames.Name, name);
                    else if (sclass != string.Empty)
                        ctrl.SearchProperties.Add(HtmlCheckBox.PropertyNames.Class, sclass);
                    else if (innertext != string.Empty)
                        ctrl.SearchProperties.Add(HtmlCheckBox.PropertyNames.InnerText, innertext);
                    else if (title != string.Empty)
                        ctrl.SearchProperties.Add(HtmlCheckBox.PropertyNames.Title, title);
                    if (ctrl != null)
                    {
                        ctrl.WaitForControlReady();
                    }
                    else
                    {
                        Assert.Fail("LocateWebPoppageCheckBox :: Control not loaded");

                    }
                }
                return ctrl;
            });
        }
        public HtmlCheckBox LocateWebPoppageCheckBoxAndHover(string id = "", string name = "", string sclass = "", string innertext = "", string title = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebPoppageCheckBox(id: id, name: name, sclass: sclass, innertext: innertext, title: title);
                if (ctrl != null)
                {
                    Mouse.Hover(ctrl);
                }
                return ctrl;
            });
        }
        public HtmlCheckBox LocateWebPoppageCheckBoxAndChecked(string id = "", string name = "", string sclass = "", string innertext = "", string title = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebCheckBox(id: id, name: name, sclass: sclass, innertext: innertext, title: title);
                if (ctrl != null)
                {
                    ctrl.Checked = true;
                }
                return ctrl;
            });
        }
        public HtmlCheckBox LocateWebPoppageCheckBoxAndUnChecked(string id = "", string name = "", string sclass = "", string innertext = "", string title = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebPoppageCheckBox(id: id, name: name, sclass: sclass, innertext: innertext, title: title);
                if (ctrl != null)
                {
                    ctrl.Checked = false;
                }
                return ctrl;
            });
        }


        public HtmlRadioButton LocateWebRadioBtn(string id = "", string name = "", string sclass = "", string innertext = "", string title = "")
        {
            return HandleExceptions(() =>
            {
                _dom = _browser.SearchAndFilterObjects<Microsoft.VisualStudio.TestTools.UITesting.HtmlControls.HtmlDocument>(new { ControlType = "Document" });
                var ctrl = new HtmlRadioButton(_dom);

                if (_dom != null)
                {
                    _dom.WaitForControlReady();
                    if (id != string.Empty && name != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<HtmlRadioButton>(new { Id = id, Name = name });
                    else if (id != string.Empty && sclass != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<HtmlRadioButton>(new { Id = id }, new { Class = sclass });
                    else if (name != string.Empty && sclass != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<HtmlRadioButton>(new { Name = name }, new { Class = sclass });
                    else if (id != string.Empty && title != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<HtmlRadioButton>(new { Id = id }, new { Title = title });
                    else if (id != string.Empty && innertext != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<HtmlRadioButton>(new { Id = id }, new { InnerText = innertext });
                    else if (id != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<HtmlRadioButton>(new { Id = id });
                    else if (name != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<HtmlRadioButton>(new { Name = name });
                    else if (sclass != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<HtmlRadioButton>(new { Class = sclass });
                    else if (innertext != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<HtmlRadioButton>(new { InnerText = innertext });
                    else if (title != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<HtmlRadioButton>(new { Title = title });
                    if (ctrl != null)
                    {
                        ctrl.WaitForControlReady();
                    }
                    else
                    {
                        Assert.Fail("LocateWebRadioBtn :: Control not loaded");

                    }
                }
                return ctrl;
            });
        }
        public HtmlRadioButton LocateWebRadioBtnAndHover(string id = "", string name = "", string sclass = "", string innertext = "", string title = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebRadioBtn(id: id, name: name, sclass: sclass, innertext: innertext, title: title);
                if (ctrl != null)
                {
                    Mouse.Hover(ctrl);
                }
                return ctrl;
            });
        }
        public HtmlRadioButton LocateWebRadioBtnAndClick(string id = "", string name = "", string sclass = "", string innertext = "", string title = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebRadioBtn(id: id, name: name, sclass: sclass, innertext: innertext, title: title);
                if (ctrl != null)
                {
                    Mouse.Click(ctrl);
                }
                return ctrl;
            });
        }

        public HtmlRadioButton LocateWebPopIframeRadioBtn(string pageid = "", string pageurl = "", string id = "", string name = "", string sclass = "", string innertext = "", string title = "")
        {
            return HandleExceptions(() =>
            {
                var getDom = GetPopIframeDom(pageid: pageid, pageurl: pageurl);
                var ctrl = new HtmlRadioButton(getDom);

                if (getDom != null)
                {
                    getDom.WaitForControlReady();
                    if (id != string.Empty && name != string.Empty)
                        ctrl = ctrl.SearchAndFilterObjects<HtmlRadioButton>(new { Id = id, Name = name });
                    else if (id != string.Empty && sclass != string.Empty)
                        ctrl = ctrl.SearchAndFilterObjects<HtmlRadioButton>(new { Id = id }, new { Class = sclass });
                    else if (name != string.Empty && sclass != string.Empty)
                        ctrl = ctrl.SearchAndFilterObjects<HtmlRadioButton>(new { Name = name }, new { Class = sclass });
                    else if (id != string.Empty && title != string.Empty)
                        ctrl = ctrl.SearchAndFilterObjects<HtmlRadioButton>(new { Id = id }, new { Title = title });
                    else if (id != string.Empty && innertext != string.Empty)
                        ctrl = ctrl.SearchAndFilterObjects<HtmlRadioButton>(new { Id = id }, new { InnerText = innertext });
                    else if (id != string.Empty)
                        ctrl = ctrl.SearchAndFilterObjects<HtmlRadioButton>(new { Id = id });
                    else if (name != string.Empty)
                        ctrl = ctrl.SearchAndFilterObjects<HtmlRadioButton>(new { Name = name });
                    else if (sclass != string.Empty)
                        ctrl = ctrl.SearchAndFilterObjects<HtmlRadioButton>(new { Class = sclass });
                    else if (innertext != string.Empty)
                        ctrl = ctrl.SearchAndFilterObjects<HtmlRadioButton>(new { InnerText = innertext });
                    else if (title != string.Empty)
                        ctrl = ctrl.SearchAndFilterObjects<HtmlRadioButton>(new { Title = title });
                    if (ctrl != null)
                    {
                        ctrl.WaitForControlReady();
                    }
                    else
                    {
                        Assert.Fail("LocateWebPopIframeRadioBtn :: Control not loaded");

                    }
                }
                return ctrl;
            });
        }
        public HtmlRadioButton LocateWebPopIframeRadioBtnAndHover(string pageid = "", string pageurl = "", string id = "", string name = "", string sclass = "", string innertext = "", string title = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebPopIframeRadioBtn(pageid: pageid, pageurl: pageurl, id: id, name: name, sclass: sclass, innertext: innertext, title: title);
                if (ctrl != null)
                {
                    Mouse.Hover(ctrl);
                }
                return ctrl;
            });
        }
        public HtmlRadioButton LocateWebPopIframeRadioBtnAndClick(string pageid = "", string pageurl = "", string id = "", string name = "", string sclass = "", string innertext = "", string title = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebPopIframeRadioBtn(pageid: pageid, pageurl: pageurl, id: id, name: name, sclass: sclass, innertext: innertext, title: title);
                if (ctrl != null)
                {
                    Mouse.Click(ctrl);
                }
                return ctrl;
            });
        }

        public UITestControl LocateSharepointPopRadioBtn(string id = "", string name = "", string sclass = "", string innertext = "", string title = "")
        {
            return HandleExceptions(() =>
            {
                var obj = new UITestControl(_browser);
                obj.TechnologyName = "Web";

                if (obj != null)
                {
                    if (id != string.Empty)
                        obj.SearchProperties.Add(HtmlRadioButton.PropertyNames.Id, id);
                    else if (name != string.Empty)
                        obj.SearchProperties.Add(HtmlRadioButton.PropertyNames.Name, name);
                    else if (title != string.Empty)
                        obj.SearchProperties.Add(HtmlRadioButton.PropertyNames.Title, title);
                    else if (sclass != string.Empty)
                        obj.SearchProperties.Add(HtmlRadioButton.PropertyNames.Class, sclass);
                    else if (innertext != string.Empty)
                        obj.SearchProperties.Add(HtmlRadioButton.PropertyNames.InnerText, innertext);
                    else if (title != string.Empty)
                        obj.SearchProperties.Add(HtmlRadioButton.PropertyNames.Title, title);
                    if (obj != null)
                    {
                        obj.WaitForControlReady();
                    }
                }
                else
                {
                    Assert.Fail("LocateSharepointPopRadioBtn :: Control not loaded");
                }
                return obj;
            });
        }
        public UITestControl LocateSharepointPopRadioBtnAndHover(string id = "", string name = "", string sclass = "", string innertext = "", string title = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateSharepointPopRadioBtn(id: id, name: name, sclass: sclass, innertext: innertext, title: title);
                if (ctrl != null)
                {
                    Mouse.Hover(ctrl);
                }
                return ctrl;
            });
        }
        public UITestControl LocateSharepointPopRadioBtnAndSelected(string id = "", string name = "", string sclass = "", string innertext = "", string title = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateSharepointPopRadioBtn(id: id, name: name, sclass: sclass, innertext: innertext, title: title);
                if (ctrl != null)
                {
                    ctrl.SetProperty(HtmlRadioButton.PropertyNames.Selected, true);
                }
                return ctrl;
            });
        }

        public HtmlRadioButton LocateWebPoppageRadioBtn(string id = "", string name = "", string sclass = "", string innertext = "", string title = "")
        {
            return HandleExceptions(() =>
            {
                var getDom = GetHtmlDocument();
                var ctrl = new HtmlRadioButton(getDom);

                if (getDom != null)
                {
                    getDom.WaitForControlReady();
                    if (id != string.Empty)
                        ctrl.SearchProperties.Add(HtmlRadioButton.PropertyNames.Id, id);
                    else if (name != string.Empty)
                        ctrl.SearchProperties.Add(HtmlRadioButton.PropertyNames.Name, name);
                    else if (sclass != string.Empty)
                        ctrl.SearchProperties.Add(HtmlRadioButton.PropertyNames.Class, sclass);
                    else if (innertext != string.Empty)
                        ctrl.SearchProperties.Add(HtmlRadioButton.PropertyNames.InnerText, innertext);
                    else if (title != string.Empty)
                        ctrl.SearchProperties.Add(HtmlRadioButton.PropertyNames.Title, title);
                    if (ctrl != null)
                    {
                        ctrl.WaitForControlReady();
                    }
                    else
                    {
                        Assert.Fail("LocateWebPoppageRadioBtn :: Control not loaded");

                    }
                }
                return ctrl;
            });
        }
        public HtmlRadioButton LocateWebPoppageRadioBtnAndHover(string id = "", string name = "", string sclass = "", string innertext = "", string title = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebPoppageRadioBtn(id: id, name: name, sclass: sclass, innertext: innertext, title: title);
                if (ctrl != null)
                {
                    Mouse.Hover(ctrl);
                }
                return ctrl;
            });
        }
        public HtmlRadioButton LocateWebPoppageRadioBtnAndClick(string id = "", string name = "", string sclass = "", string innertext = "", string title = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebRadioBtn(id: id, name: name, sclass: sclass, innertext: innertext, title: title);
                if (ctrl != null)
                {
                    Mouse.Click(ctrl);
                }
                return ctrl;
            });
        }


        #endregion

        #region Locate Web File Upload and do the actions
        public HtmlFileInput LocateWebFileInput(string id = "", string name = "", string sclass = "", string innertext = "")
        {
            return HandleExceptions(() =>
            {
                _dom = _browser.SearchAndFilterObjects<Microsoft.VisualStudio.TestTools.UITesting.HtmlControls.HtmlDocument>(new { ControlType = "Document" });
                var link = new HtmlFileInput();

                if (_dom != null)
                {
                    _dom.WaitForControlReady();
                    if (id != string.Empty && name != string.Empty)
                        link = _dom.SearchAndFilterObjects<HtmlFileInput>(new { Id = id, Name = name });
                    else if (sclass != string.Empty && innertext != string.Empty)
                        link = _dom.SearchAndFilterObjects<HtmlFileInput>(new { Class = sclass, InnerText = innertext });
                    else if (name != string.Empty && innertext != string.Empty)
                        link = _dom.SearchAndFilterObjects<HtmlFileInput>(new { Name = name }, new { InnerText = innertext });
                    else if (id != string.Empty && innertext != string.Empty)
                        link = _dom.SearchAndFilterObjects<HtmlFileInput>(new { ID = id }, new { InnerText = innertext });
                    else if (id != string.Empty && sclass != string.Empty)
                        link = _dom.SearchAndFilterObjects<HtmlFileInput>(new { Id = id }, new { Class = sclass });
                    else if (id != string.Empty)
                        link = _dom.SearchAndFilterObjects<HtmlFileInput>(new { Id = id });
                    else if (name != string.Empty)
                        link = _dom.SearchAndFilterObjects<HtmlFileInput>(new { Name = name });
                    else if (sclass != string.Empty)
                        link = _dom.SearchAndFilterObjects<HtmlFileInput>(new { Class = sclass });
                    else if (innertext != string.Empty)
                        link = _dom.SearchAndFilterObjects<HtmlFileInput>(new { InnerText = innertext });
                    if (link != null)
                    {
                        link.WaitForControlReady();
                    }
                    else
                    {
                        Assert.Fail("LocateWebFileInput :: Control not loaded");

                    }
                }
                return link;
            });
        }
        public HtmlFileInput LocateWebFileInputAndClick(string id = "", string name = "", string sclass = "", string innertext = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebFileInput(id: id, name: name, sclass: sclass, innertext: innertext);
                if (ctrl != null)
                {
                    Mouse.Click(ctrl);
                }
                return ctrl;
            });
        }
        public HtmlFileInput LocateWebFileInputAndDoubleClick(string id = "", string name = "", string sclass = "", string innertext = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebFileInput(id: id, name: name, sclass: sclass, innertext: innertext);
                if (ctrl != null)
                {
                    Mouse.DoubleClick(ctrl);
                }
                return ctrl;
            });
        }
        public HtmlFileInput LocateWebFileInputAndHover(string id = "", string name = "", string sclass = "", string innertext = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebFileInput(id: id, name: name, sclass: sclass, innertext: innertext);
                if (ctrl != null)
                {
                    Mouse.Hover(ctrl);
                }
                return ctrl;
            });
        }

        public HtmlFileInput LocateWebPoppageFileInput(string id = "", string name = "", string sclass = "", string innertext = "", string title = "")
        {
            return HandleExceptions(() =>
            {
                var getDom = GetHtmlDocument();
                var ctrl = new HtmlFileInput(getDom);

                if (getDom != null)
                {
                    getDom.WaitForControlReady();
                    getDom.WaitForControlReady();
                    if (id != string.Empty)
                        ctrl.SearchProperties.Add(HtmlRadioButton.PropertyNames.Id, id);
                    else if (name != string.Empty)
                        ctrl.SearchProperties.Add(HtmlRadioButton.PropertyNames.Name, name);
                    else if (sclass != string.Empty)
                        ctrl.SearchProperties.Add(HtmlRadioButton.PropertyNames.Class, sclass);
                    else if (innertext != string.Empty)
                        ctrl.SearchProperties.Add(HtmlRadioButton.PropertyNames.InnerText, innertext);
                    else if (title != string.Empty)
                        ctrl.SearchProperties.Add(HtmlRadioButton.PropertyNames.Title, title);
                    if (ctrl != null)
                    {
                        ctrl.WaitForControlReady();
                    }
                    else
                    {
                        Assert.Fail("LocateWebPoppageFileInput :: Control not loaded");

                    }
                }
                return ctrl;
            });
        }
        public HtmlFileInput LocateWebPoppageFileInputAndClick(string id = "", string name = "", string sclass = "", string innertext = "", string title = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebPoppageFileInput(id: id, name: name, sclass: sclass, innertext: innertext, title: title);
                if (ctrl != null)
                {
                    Mouse.Click(ctrl);
                }
                return ctrl;
            });
        }
        public HtmlFileInput LocateWebPoppageFileInputAndDoubleClick(string id = "", string name = "", string sclass = "", string innertext = "", string title = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebPoppageFileInput(id: id, name: name, sclass: sclass, innertext: innertext, title: title);
                if (ctrl != null)
                {
                    Mouse.DoubleClick(ctrl);
                }
                return ctrl;
            });
        }
        public HtmlFileInput LocateWebPoppageFileInputAndHover(string id = "", string name = "", string sclass = "", string innertext = "", string title = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebPoppageFileInput(id: id, name: name, sclass: sclass, innertext: innertext, title: title);
                if (ctrl != null)
                {
                    Mouse.Hover(ctrl);
                }
                return ctrl;
            });
        }

        public HtmlFileInput LocateWebPopIframeFileInput(string pageid = "", string pageurl = "", string id = "", string name = "", string sclass = "", string innertext = "", string title = "")
        {
            return HandleExceptions(() =>
            {
                var getDom = GetPopIframeDom(pageid: pageid, pageurl: pageurl);
                var ctrl = new HtmlFileInput(getDom);

                if (getDom != null)
                {
                    getDom.WaitForControlReady();
                    if (id != string.Empty && name != string.Empty)
                        ctrl = ctrl.SearchAndFilterObjects<HtmlFileInput>(new { Id = id, Name = name });
                    else if (id != string.Empty && sclass != string.Empty)
                        ctrl = ctrl.SearchAndFilterObjects<HtmlFileInput>(new { Id = id }, new { Class = sclass });
                    else if (name != string.Empty && sclass != string.Empty)
                        ctrl = ctrl.SearchAndFilterObjects<HtmlFileInput>(new { Name = name }, new { Class = sclass });
                    else if (id != string.Empty && title != string.Empty)
                        ctrl = ctrl.SearchAndFilterObjects<HtmlFileInput>(new { Id = id }, new { Title = title });
                    else if (id != string.Empty && innertext != string.Empty)
                        ctrl = ctrl.SearchAndFilterObjects<HtmlFileInput>(new { Id = id }, new { InnerText = innertext });
                    else if (id != string.Empty)
                        ctrl = ctrl.SearchAndFilterObjects<HtmlFileInput>(new { Id = id });
                    else if (name != string.Empty)
                        ctrl = ctrl.SearchAndFilterObjects<HtmlFileInput>(new { Name = name });
                    else if (sclass != string.Empty)
                        ctrl = ctrl.SearchAndFilterObjects<HtmlFileInput>(new { Class = sclass });
                    else if (innertext != string.Empty)
                        ctrl = ctrl.SearchAndFilterObjects<HtmlFileInput>(new { InnerText = innertext });
                    else if (title != string.Empty)
                        ctrl = ctrl.SearchAndFilterObjects<HtmlFileInput>(new { Title = title });
                    if (ctrl != null)
                    {
                        ctrl.WaitForControlReady();
                    }
                    else
                    {
                        Assert.Fail("LocateWebPopIframeFileInput :: Control not loaded");

                    }
                }
                return ctrl;
            });
        }
        public HtmlFileInput LocateWebPopIframeFileInputAndClick(string pageid = "", string pageurl = "", string id = "", string name = "", string sclass = "", string innertext = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebPopIframeFileInput(pageid: pageid, pageurl: pageurl, id: id, name: name, sclass: sclass, innertext: innertext);
                if (ctrl != null)
                {
                    Mouse.Click(ctrl);
                }
                return ctrl;
            });
        }
        public HtmlFileInput LocateWebPopIframeFileInputAndDoubleClick(string pageid = "", string pageurl = "", string id = "", string name = "", string sclass = "", string innertext = "", string title = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebPopIframeFileInput(pageid: pageid, pageurl: pageurl, id: id, name: name, sclass: sclass, innertext: innertext);
                if (ctrl != null)
                {
                    Mouse.DoubleClick(ctrl);
                }
                return ctrl;
            });
        }
        public HtmlFileInput LocateWebPopIframeFileInputAndHover(string pageid = "", string pageurl = "", string id = "", string name = "", string sclass = "", string innertext = "", string title = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebPopIframeFileInput(pageid: pageid, pageurl: pageurl, id: id, name: name, sclass: sclass, innertext: innertext);
                if (ctrl != null)
                {
                    Mouse.Hover(ctrl);
                }
                return ctrl;
            });
        }

        public UITestControl LocateSharepointPopIframeFileInput(string id = "", string name = "", string sclass = "", string innertext = "", string title = "")
        {
            return HandleExceptions(() =>
            {
                var obj = new UITestControl(_browser);
                obj.TechnologyName = "Web";

                if (obj != null)
                {
                    if (id != string.Empty)
                        obj.SearchProperties.Add(HtmlFileInput.PropertyNames.Id, id);
                    else if (name != string.Empty)
                        obj.SearchProperties.Add(HtmlFileInput.PropertyNames.Name, name);
                    else if (sclass != string.Empty)
                        obj.SearchProperties.Add(HtmlFileInput.PropertyNames.Class, sclass);
                    else if (innertext != string.Empty)
                        obj.SearchProperties.Add(HtmlFileInput.PropertyNames.InnerText, innertext);
                    else if (title != string.Empty)
                        obj.SearchProperties.Add(HtmlFileInput.PropertyNames.Title, title);

                    if (obj != null)
                    {
                        obj.WaitForControlReady();
                    }
                }
                else
                {
                    Assert.Fail("LocateSharepointPopIframeFileInput :: Control not loaded");
                }
                return obj;
            });
        }
        public UITestControl LocateSharepointPopIframeFileInputAndClick(string id = "", string name = "", string sclass = "", string innertext = "", string title = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateSharepointPopIframeFileInput(id: id, name: name, sclass: sclass, innertext: innertext, title: title);
                if (ctrl != null)
                {
                    Mouse.Click(new Point(ctrl.BoundingRectangle.X + 50, ctrl.BoundingRectangle.Y + 14));
                }
                return ctrl;
            });
        }
        public UITestControl LocateSharepointPopIframeFileInputAndDoubleClick(string id = "", string name = "", string sclass = "", string innertext = "", string title = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateSharepointPopIframeFileInput(id: id, name: name, sclass: sclass, innertext: innertext, title: title);
                if (ctrl != null)
                {
                    Mouse.DoubleClick(new Point(ctrl.BoundingRectangle.X + 50, ctrl.BoundingRectangle.Y + 14));
                }
                return ctrl;
            });
        }
        public UITestControl LocateSharepointPopIframeFileInputAndHover(string id = "", string name = "", string sclass = "", string innertext = "", string title = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateSharepointPopIframeFileInput(id: id, name: name, sclass: sclass, innertext: innertext, title: title);
                if (ctrl != null)
                {
                    Mouse.Hover(new Point(ctrl.BoundingRectangle.X + 50, ctrl.BoundingRectangle.Y + 14));
                }
                return ctrl;
            });
        }

        #endregion

        #region Locate Web input button and actions
        public HtmlInputButton LocateWebInputBtn(string id = "", string name = "", string sclass = "", string innertext = "", string title = "", string displayText = "")
        {
            return HandleExceptions(() =>
            {
                _dom = _browser.SearchAndFilterObjects<Microsoft.VisualStudio.TestTools.UITesting.HtmlControls.HtmlDocument>(new { ControlType = "Document" });
                var link = new HtmlInputButton();

                if (_dom != null)
                {
                    _dom.WaitForControlReady();
                    if (id != string.Empty && name != string.Empty)
                        link = _dom.SearchAndFilterObjects<HtmlInputButton>(new { Id = id, Name = name });
                    else if (sclass != string.Empty && innertext != string.Empty)
                        link = _dom.SearchAndFilterObjects<HtmlInputButton>(new { Class = sclass, InnerText = innertext });
                    else if (name != string.Empty && innertext != string.Empty)
                        link = _dom.SearchAndFilterObjects<HtmlInputButton>(new { Name = name }, new { InnerText = innertext });
                    else if (id != string.Empty && innertext != string.Empty)
                        link = _dom.SearchAndFilterObjects<HtmlInputButton>(new { ID = id }, new { InnerText = innertext });
                    else if (id != string.Empty && sclass != string.Empty)
                        link = _dom.SearchAndFilterObjects<HtmlInputButton>(new { Id = id }, new { Class = sclass });
                    else if (id != string.Empty && title != string.Empty)
                        link = _dom.SearchAndFilterObjects<HtmlInputButton>(new { Id = id }, new { Title = title });
                    else if (id != string.Empty)
                        link = _dom.SearchAndFilterObjects<HtmlInputButton>(new { Id = id });
                    else if (name != string.Empty)
                        link = _dom.SearchAndFilterObjects<HtmlInputButton>(new { Name = name });
                    else if (sclass != string.Empty)
                        link = _dom.SearchAndFilterObjects<HtmlInputButton>(new { Class = sclass });
                    else if (innertext != string.Empty)
                        link = _dom.SearchAndFilterObjects<HtmlInputButton>(new { InnerText = innertext });
                    else if (title != string.Empty)
                        link = _dom.SearchAndFilterObjects<HtmlInputButton>(new { Title = title });
                    else if (displayText != string.Empty)
                        link = _dom.SearchAndFilterObjects<HtmlInputButton>(new { DisplayText = displayText });

                    if (link != null)
                    {
                        link.WaitForControlReady();
                    }
                    else
                    {
                        Assert.Fail("LocateWebInputBtn :: Control not loaded");

                    }
                }
                return link;
            });
        }
        public HtmlInputButton LocateWebInputBtnAndClick(string id = "", string name = "", string sclass = "", string innertext = "", string title = "", string displayText = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebInputBtn(id: id, name: name, sclass: sclass, innertext: innertext, title: title, displayText: displayText);
                if (ctrl != null)
                {
                    Mouse.Click(ctrl);
                }
                return ctrl;
            });
        }
        public HtmlInputButton LocateWebInputBtnAndDoubleClick(string id = "", string name = "", string sclass = "", string innertext = "", string title = "", string displayText = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebInputBtn(id: id, name: name, sclass: sclass, innertext: innertext, title: title, displayText: displayText);
                if (ctrl != null)
                {
                    Mouse.DoubleClick(ctrl);
                }
                return ctrl;
            });
        }
        public HtmlInputButton LocateWebInputBtnAndHover(string id = "", string name = "", string sclass = "", string innertext = "", string title = "", string displayText = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebInputBtn(id: id, name: name, sclass: sclass, innertext: innertext, title: title, displayText: displayText);
                if (ctrl != null)
                {
                    Mouse.Hover(ctrl);
                }
                return ctrl;
            });
        }

        public HtmlInputButton LocateWebPoppageInputBtn(string id = "", string name = "", string sclass = "", string innertext = "", string title = "", string displayText = "")
        {
            return HandleExceptions(() =>
            {
                var getDom = GetHtmlDocument();
                var ctrl = new HtmlInputButton(getDom);

                if (getDom != null)
                {
                    getDom.WaitForControlReady();
                    if (id != string.Empty)
                        ctrl.SearchProperties.Add(HtmlInputButton.PropertyNames.Id, id);
                    else if (name != string.Empty)
                        ctrl.SearchProperties.Add(HtmlInputButton.PropertyNames.Name, name);
                    else if (sclass != string.Empty)
                        ctrl.SearchProperties.Add(HtmlInputButton.PropertyNames.Class, sclass);
                    else if (title != string.Empty)
                        ctrl.SearchProperties.Add(HtmlInputButton.PropertyNames.Title, title);
                    else if (innertext != string.Empty)
                        ctrl.SearchProperties.Add(HtmlInputButton.PropertyNames.InnerText, innertext);
                    else if (displayText != string.Empty)
                        ctrl.SearchProperties.Add(HtmlInputButton.PropertyNames.DisplayText, displayText);
                    if (ctrl != null)
                    {
                        ctrl.WaitForControlReady();
                    }
                    else
                    {
                        Assert.Fail("LocateWebPoppageInputBtn :: Control not loaded");

                    }
                }
                return ctrl;
            });
        }
        public HtmlInputButton LocateWebPoppageInputBtnAndClick(string id = "", string name = "", string sclass = "", string innertext = "", string title = "", string displayText = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebPoppageInputBtn(id: id, name: name, sclass: sclass, innertext: innertext, title: title, displayText: displayText);
                if (ctrl != null)
                {
                    Mouse.Click(ctrl);
                }
                return ctrl;
            });
        }
        public HtmlInputButton LocateWebPoppageInputBtnAndDoubleClick(string id = "", string name = "", string sclass = "", string innertext = "", string title = "", string displayText = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebPoppageInputBtn(id: id, name: name, sclass: sclass, innertext: innertext, title: title, displayText: displayText);
                if (ctrl != null)
                {
                    Mouse.Click(ctrl);
                    ctrl.WaitForControlReady(2000);
                    Mouse.Click(ctrl);
                }
                return ctrl;
            });
        }
        public HtmlInputButton LocateWebPoppageInputBtnAndHover(string id = "", string name = "", string sclass = "", string innertext = "", string title = "", string displayText = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebPoppageInputBtn(id: id, name: name, sclass: sclass, innertext: innertext, title: title, displayText: displayText);
                if (ctrl != null)
                {
                    Mouse.Hover(ctrl);
                }
                return ctrl;
            });
        }

        public HtmlInputButton LocateWebPopIframeInputBtn(string pageid = "", string pageurl = "", string id = "", string name = "", string sclass = "", string innertext = "", string title = "", string displayText = "")
        {
            return HandleExceptions(() =>
            {
                var getDom = GetPopIframeDom(pageid: pageid, pageurl: pageurl);
                var ctrl = new HtmlInputButton(getDom);

                if (getDom != null)
                {
                    getDom.WaitForControlReady();
                    if (id != string.Empty && name != string.Empty)
                        ctrl = ctrl.SearchAndFilterObjects<HtmlInputButton>(new { Id = id, Name = name });
                    else if (id != string.Empty && sclass != string.Empty)
                        ctrl = ctrl.SearchAndFilterObjects<HtmlInputButton>(new { Id = id }, new { Class = sclass });
                    else if (name != string.Empty && sclass != string.Empty)
                        ctrl = ctrl.SearchAndFilterObjects<HtmlInputButton>(new { Name = name }, new { Class = sclass });
                    else if (id != string.Empty && title != string.Empty)
                        ctrl = ctrl.SearchAndFilterObjects<HtmlInputButton>(new { Id = id }, new { Title = title });
                    else if (id != string.Empty && innertext != string.Empty)
                        ctrl = ctrl.SearchAndFilterObjects<HtmlInputButton>(new { Id = id }, new { InnerText = innertext });
                    else if (id != string.Empty)
                        ctrl = ctrl.SearchAndFilterObjects<HtmlInputButton>(new { Id = id });
                    else if (name != string.Empty)
                        ctrl = ctrl.SearchAndFilterObjects<HtmlInputButton>(new { Name = name });
                    else if (sclass != string.Empty)
                        ctrl = ctrl.SearchAndFilterObjects<HtmlInputButton>(new { Class = sclass });
                    else if (innertext != string.Empty)
                        ctrl = ctrl.SearchAndFilterObjects<HtmlInputButton>(new { InnerText = innertext });
                    else if (title != string.Empty)
                        ctrl = ctrl.SearchAndFilterObjects<HtmlInputButton>(new { Title = title });
                    else if (displayText != string.Empty)
                        ctrl = ctrl.SearchAndFilterObjects<HtmlInputButton>(new { DisplayText = displayText });
                    if (ctrl != null)
                    {
                        ctrl.WaitForControlReady();
                    }
                    else
                    {
                        Assert.Fail("LocateWebPopIframeInputBtn :: Control not loaded");

                    }
                }
                return ctrl;
            });
        }
        public HtmlInputButton LocateWebPopIframeInputBtnAndClick(string pageid = "", string pageurl = "", string id = "", string name = "", string sclass = "", string innertext = "", string title = "", string displayText = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebPopIframeInputBtn(pageid: pageid, pageurl: pageurl, id: id, name: name, sclass: sclass, innertext: innertext, title: title, displayText: displayText);
                if (ctrl != null)
                {
                    Mouse.Click(ctrl);
                }
                return ctrl;
            });
        }
        public HtmlInputButton LocateWebPopIframeInputBtnAndDoubleClick(string pageid = "", string pageurl = "", string id = "", string name = "", string sclass = "", string innertext = "", string title = "", string displayText = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebPopIframeInputBtn(pageid: pageid, pageurl: pageurl, id: id, name: name, sclass: sclass, innertext: innertext, title: title, displayText: displayText);
                if (ctrl != null)
                {
                    Mouse.DoubleClick(ctrl);
                }
                return ctrl;
            });
        }
        public HtmlInputButton LocateWebPopIframeInputBtnAndHover(string pageid = "", string pageurl = "", string id = "", string name = "", string sclass = "", string innertext = "", string title = "", string displayText = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebPopIframeInputBtn(pageid: pageid, pageurl: pageurl, id: id, name: name, sclass: sclass, innertext: innertext, title: title, displayText: displayText);
                if (ctrl != null)
                {
                    Mouse.Hover(ctrl);
                }
                return ctrl;
            });
        }

        public HtmlInputButton LocateSharepointPopWithinInputBtn(string id = "", string name = "", string sclass = "", string innertext = "", string title = "", string displayText = "")
        {
            return HandleExceptions(() =>
            {
                var obj = new UITestControl(_browser);
                obj.TechnologyName = "Web";
                var ctrl = new HtmlInputButton(obj);
                if (obj != null)
                {
                    if (id != string.Empty)
                        ctrl.SearchProperties.Add(HtmlInputButton.PropertyNames.Id, id);
                    else if (name != string.Empty)
                        ctrl.SearchProperties.Add(HtmlInputButton.PropertyNames.Name, name);
                    else if (sclass != string.Empty)
                        ctrl.SearchProperties.Add(HtmlInputButton.PropertyNames.Class, sclass);
                    else if (innertext != string.Empty)
                        ctrl.SearchProperties.Add(HtmlInputButton.PropertyNames.InnerText, innertext);
                    else if (title != string.Empty)
                        ctrl.SearchProperties.Add(HtmlInputButton.PropertyNames.Title, title);
                    else if (displayText != string.Empty)
                        ctrl.SearchProperties.Add(HtmlInputButton.PropertyNames.DisplayText, displayText);

                    if (ctrl != null)
                    {
                        ctrl.WaitForControlReady();
                    }
                }
                else
                {
                    Assert.Fail("LocateSharepointPopInputButton :: Control not loaded");
                }
                return ctrl;
            });
        }
        public HtmlInputButton LocateSharepointPopWithinInputBtnAndClick(string id = "", string name = "", string sclass = "", string innertext = "", string title = "", string displayText = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateSharepointPopWithinInputBtn(id: id, name: name, sclass: sclass, innertext: innertext, title: title, displayText: displayText);
                if (ctrl != null)
                {
                    Mouse.Click(ctrl);
                    //Mouse.Click(new Point(ctrl.BoundingRectangle.X + 50, ctrl.BoundingRectangle.Y + 14));
                }
                return ctrl;
            });
        }
        public HtmlInputButton LocateSharepointPopWithinInputBtnAndDoubleClick(string id = "", string name = "", string sclass = "", string innertext = "", string title = "", string displayText = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateSharepointPopWithinInputBtn(id: id, name: name, sclass: sclass, innertext: innertext, title: title, displayText: displayText);
                if (ctrl != null)
                {
                    Mouse.DoubleClick(ctrl);
                }
                return ctrl;
            });
        }
        public HtmlInputButton LocateSharepointPopWithinInputBtnAndHover(string id = "", string name = "", string sclass = "", string innertext = "", string title = "", string displayText = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateSharepointPopWithinInputBtn(id: id, name: name, sclass: sclass, innertext: innertext, title: title, displayText: displayText);
                if (ctrl != null)
                {
                    Mouse.Hover(ctrl);
                }
                return ctrl;
            });
        }

        public UITestControl LocateSharepointPopButton(string id = "", string name = "", string sclass = "", string innertext = "", string title = "", string displayText = "")
        {
            return HandleExceptions(() =>
            {
                var obj = new UITestControl(_browser);
                obj.TechnologyName = "Web";
                if (obj != null)
                {
                    if (id != string.Empty)
                        obj.SearchProperties.Add(HtmlInputButton.PropertyNames.Id, id);
                    else if (name != string.Empty)
                        obj.SearchProperties.Add(HtmlInputButton.PropertyNames.Name, name);
                    else if (sclass != string.Empty)
                        obj.SearchProperties.Add(HtmlInputButton.PropertyNames.Class, sclass);
                    else if (innertext != string.Empty)
                        obj.SearchProperties.Add(HtmlInputButton.PropertyNames.InnerText, innertext);
                    else if (title != string.Empty)
                        obj.SearchProperties.Add(HtmlInputButton.PropertyNames.Title, title);
                    else if (displayText != string.Empty)
                        obj.SearchProperties.Add(HtmlInputButton.PropertyNames.DisplayText, displayText);
                    // ObjButton.SearchProperties.Add(HtmlInputButton.PropertyNames.Id, id);
                    obj.WaitForControlReady(3000);
                    // Mouse.Click(Obj);
                }
                else
                {
                    Assert.Fail("LocateSharepointPopButton :: Control not loaded");
                }
                return obj;
            });
        }
        public UITestControl LocateSharepointPopButtonAndClick(string id = "", string name = "", string sclass = "", string innertext = "", string title = "", string displayText = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateSharepointPopButton(id: id, name: name, sclass: sclass, innertext: innertext, title: title, displayText: displayText);
                if (ctrl != null)
                {
                    Mouse.Click(ctrl);
                }
                return ctrl;
            });
        }
        public UITestControl LocateSharepointPopButtonWaitControlAndClick(string id = "", string name = "", string sclass = "", string innertext = "", string title = "", string displayText = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateSharepointPopButton(id: id, name: name, sclass: sclass, innertext: innertext, title: title, displayText: displayText);
                if (ctrl != null)
                {
                    Mouse.Click(ctrl);
                    Playback.Wait(1500);
                    Mouse.Click(ctrl);
                }
                return ctrl;
            });
        }
        public UITestControl LocateSharepointPopButtonAndDoubleClick(string id = "", string name = "", string sclass = "", string innertext = "", string title = "", string displayText = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateSharepointPopButton(id: id, name: name, sclass: sclass, innertext: innertext, title: title, displayText: displayText);
                if (ctrl != null)
                {
                    Mouse.DoubleClick(ctrl);
                }
                return ctrl;
            });
        }
        public UITestControl LocateSharepointPopButtonAndHover(string id = "", string name = "", string sclass = "", string innertext = "", string title = "", string displayText = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateSharepointPopButton(id: id, name: name, sclass: sclass, innertext: innertext, title: title, displayText: displayText);
                if (ctrl != null)
                {
                    Mouse.Hover(ctrl);
                }
                return ctrl;
            });
        }
        #endregion

        #region Locate Web buttons and do the actions
        public HtmlButton LocateWebButtons(string id = "", string name = "", string sclass = "", string innertext = "", string title = "", string displayText = "")
        {
            return HandleExceptions(() =>
            {
                _dom = _browser.SearchAndFilterObjects<Microsoft.VisualStudio.TestTools.UITesting.HtmlControls.HtmlDocument>(new { ControlType = "Document" });
                var link = new HtmlButton();

                if (_dom != null)
                {
                    _dom.WaitForControlReady();
                    if (id != string.Empty && name != string.Empty)
                        link = _dom.SearchAndFilterObjects<HtmlButton>(new { Id = id, Name = name });
                    else if (sclass != string.Empty && innertext != string.Empty)
                        link = _dom.SearchAndFilterObjects<HtmlButton>(new { Class = sclass, InnerText = innertext });
                    else if (name != string.Empty && innertext != string.Empty)
                        link = _dom.SearchAndFilterObjects<HtmlButton>(new { Name = name }, new { InnerText = innertext });
                    else if (id != string.Empty && innertext != string.Empty)
                        link = _dom.SearchAndFilterObjects<HtmlButton>(new { ID = id }, new { InnerText = innertext });
                    else if (id != string.Empty && sclass != string.Empty)
                        link = _dom.SearchAndFilterObjects<HtmlButton>(new { Id = id }, new { Class = sclass });
                    else if (id != string.Empty && title != string.Empty)
                        link = _dom.SearchAndFilterObjects<HtmlButton>(new { Id = id }, new { Title = title });
                    else if (id != string.Empty)
                        link = _dom.SearchAndFilterObjects<HtmlButton>(new { Id = id });
                    else if (name != string.Empty)
                        link = _dom.SearchAndFilterObjects<HtmlButton>(new { Name = name });
                    else if (sclass != string.Empty)
                        link = _dom.SearchAndFilterObjects<HtmlButton>(new { Class = sclass });
                    else if (innertext != string.Empty)
                        link = _dom.SearchAndFilterObjects<HtmlButton>(new { InnerText = innertext });
                    else if (title != string.Empty)
                        link = _dom.SearchAndFilterObjects<HtmlButton>(new { Title = title });
                    else if (displayText != string.Empty)
                        link = _dom.SearchAndFilterObjects<HtmlButton>(new { DisplayText = displayText });

                    if (link != null)
                    {
                        link.WaitForControlReady();
                    }
                    else
                    {
                        Assert.Fail("LocateWebBottons :: Control not loaded");

                    }
                }
                return link;
            });
        }
        public HtmlButton LocateWebButtonsAndClick(string id = "", string name = "", string sclass = "", string innertext = "", string title = "", string displayText = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebButtons(id: id, name: name, sclass: sclass, innertext: innertext, title: title, displayText: displayText);
                if (ctrl != null)
                {
                    Mouse.Click(ctrl);
                }
                return ctrl;
            });
        }
        public HtmlButton LocateWebButtonsAndDoubleClick(string id = "", string name = "", string sclass = "", string innertext = "", string title = "", string displayText = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebButtons(id: id, name: name, sclass: sclass, innertext: innertext, title: title, displayText: displayText);
                if (ctrl != null)
                {
                    Mouse.DoubleClick(ctrl);
                }
                return ctrl;
            });
        }
        public HtmlButton LocateWebButtonsAndHover(string id = "", string name = "", string sclass = "", string innertext = "", string title = "", string displayText = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebButtons(id: id, name: name, sclass: sclass, innertext: innertext, title: title, displayText: displayText);
                if (ctrl != null)
                {
                    Mouse.Hover(ctrl);
                }
                return ctrl;
            });
        }

        public HtmlButton LocateWebPopButtons(string id = "", string name = "", string sclass = "", string innertext = "", string title = "", string displayTxt = "")
        {
            return HandleExceptions(() =>
            {
                var getDom = GetHtmlDocument();
                var ctrl = new HtmlButton(getDom);

                if (getDom != null)
                {
                    getDom.WaitForControlReady();
                    if (id != string.Empty)
                        ctrl.SearchProperties.Add(HtmlButton.PropertyNames.Id, id);
                    else if (name != string.Empty)
                        ctrl.SearchProperties.Add(HtmlButton.PropertyNames.Name, name);
                    else if (sclass != string.Empty)
                        ctrl.SearchProperties.Add(HtmlButton.PropertyNames.Class, sclass);
                    else if (title != string.Empty)
                        ctrl.SearchProperties.Add(HtmlButton.PropertyNames.Title, title);
                    else if (innertext != string.Empty)
                        ctrl.SearchProperties.Add(HtmlButton.PropertyNames.InnerText, innertext);
                    else if (displayTxt != string.Empty)
                        ctrl.SearchProperties.Add(HtmlButton.PropertyNames.DisplayText, displayTxt);
                    if (ctrl != null)
                    {
                        ctrl.WaitForControlReady();
                    }
                    else
                    {
                        Assert.Fail("LocateWebPopButtons :: Control not loaded");

                    }
                }
                return ctrl;
            });
        }
        public HtmlButton LocateWebPopButtonsAndClick(string id = "", string name = "", string sclass = "", string innertext = "", string title = "", string displayTxt = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebPopButtons(id: id, name: name, sclass: sclass, innertext: innertext, title: title, displayTxt: displayTxt);
                if (ctrl != null)
                {
                    Mouse.Click(ctrl);
                }
                return ctrl;
            });
        }
        public HtmlButton LocateWebPopButtonsAndDoubleClick(string id = "", string name = "", string sclass = "", string innertext = "", string title = "", string displayTxt = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebPopButtons(id: id, name: name, sclass: sclass, innertext: innertext, title: title, displayTxt: displayTxt);
                if (ctrl != null)
                {
                    Mouse.Click(ctrl);
                    ctrl.WaitForControlReady(2000);
                    Mouse.Click(ctrl);
                }
                return ctrl;
            });
        }
        public HtmlButton LocateWebPopButtonsAndHover(string id = "", string name = "", string sclass = "", string innertext = "", string title = "", string displayTxt = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebPopButtons(id: id, name: name, sclass: sclass, innertext: innertext, title: title, displayTxt: displayTxt);
                if (ctrl != null)
                {
                    Mouse.Hover(ctrl);
                }
                return ctrl;
            });
        }

        public HtmlButton LocateWebPopIframeButtons(string pageid = "", string pageurl = "", string id = "", string name = "", string sclass = "", string innertext = "", string title = "", string displayTxt = "")
        {
            return HandleExceptions(() =>
            {
                var getDom = GetPopIframeDom(pageid: pageid, pageurl: pageurl);
                var ctrl = new HtmlButton(getDom);

                if (getDom != null)
                {
                    getDom.WaitForControlReady();
                    if (id != string.Empty && name != string.Empty)
                        ctrl = ctrl.SearchAndFilterObjects<HtmlButton>(new { Id = id, Name = name });
                    else if (id != string.Empty && sclass != string.Empty)
                        ctrl = ctrl.SearchAndFilterObjects<HtmlButton>(new { Id = id }, new { Class = sclass });
                    else if (name != string.Empty && sclass != string.Empty)
                        ctrl = ctrl.SearchAndFilterObjects<HtmlButton>(new { Name = name }, new { Class = sclass });
                    else if (id != string.Empty && title != string.Empty)
                        ctrl = ctrl.SearchAndFilterObjects<HtmlButton>(new { Id = id }, new { Title = title });
                    else if (id != string.Empty && innertext != string.Empty)
                        ctrl = ctrl.SearchAndFilterObjects<HtmlButton>(new { Id = id }, new { InnerText = innertext });
                    else if (id != string.Empty)
                        ctrl = ctrl.SearchAndFilterObjects<HtmlButton>(new { Id = id });
                    else if (name != string.Empty)
                        ctrl = ctrl.SearchAndFilterObjects<HtmlButton>(new { Name = name });
                    else if (sclass != string.Empty)
                        ctrl = ctrl.SearchAndFilterObjects<HtmlButton>(new { Class = sclass });
                    else if (innertext != string.Empty)
                        ctrl = ctrl.SearchAndFilterObjects<HtmlButton>(new { InnerText = innertext });
                    else if (title != string.Empty)
                        ctrl = ctrl.SearchAndFilterObjects<HtmlButton>(new { Title = title });
                    else if (displayTxt != string.Empty)
                        ctrl = ctrl.SearchAndFilterObjects<HtmlButton>(new { DisplayText = displayTxt });
                    if (ctrl != null)
                    {
                        ctrl.WaitForControlReady();
                    }
                    else
                    {
                        Assert.Fail("LocateWebPopIframeButtons :: Control not loaded");

                    }
                }
                return ctrl;
            });
        }
        public HtmlButton LocateWebPopIframeButtonsAndClick(string pageid = "", string pageurl = "", string id = "", string name = "", string sclass = "", string innertext = "", string title = "", string displayTxt = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebPopIframeButtons(pageid: pageid, pageurl: pageurl, id: id, name: name, sclass: sclass, innertext: innertext, title: title, displayTxt: displayTxt);
                if (ctrl != null)
                {
                    Mouse.Click(ctrl);
                }
                return ctrl;
            });
        }
        public HtmlButton LocateWebPopIframeButtonsAndDoubleClick(string pageid = "", string pageurl = "", string id = "", string name = "", string sclass = "", string innertext = "", string title = "", string displayTxt = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebPopIframeButtons(pageid: pageid, pageurl: pageurl, id: id, name: name, sclass: sclass, innertext: innertext, title: title, displayTxt: displayTxt);
                if (ctrl != null)
                {
                    Mouse.DoubleClick(ctrl);
                }
                return ctrl;
            });
        }
        public HtmlButton LocateWebPopIframeButtonsAndHover(string pageid = "", string pageurl = "", string id = "", string name = "", string sclass = "", string innertext = "", string title = "", string displayTxt = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebPopIframeButtons(pageid: pageid, pageurl: pageurl, id: id, name: name, sclass: sclass, innertext: innertext, title: title, displayTxt: displayTxt);
                if (ctrl != null)
                {
                    Mouse.Hover(ctrl);
                }
                return ctrl;
            });
        }

        public UITestControl LocateSharepointPopIframeButtons(string id = "", string name = "", string sclass = "", string innertext = "", string title = "", string displayTxt = "")
        {
            return HandleExceptions(() =>
            {
                var obj = new UITestControl(_browser);
                obj.TechnologyName = "Web";

                if (obj != null)
                {
                    if (id != string.Empty)
                        obj.SearchProperties.Add(HtmlButton.PropertyNames.Id, id);
                    else if (name != string.Empty)
                        obj.SearchProperties.Add(HtmlButton.PropertyNames.Name, name);
                    else if (sclass != string.Empty)
                        obj.SearchProperties.Add(HtmlButton.PropertyNames.Class, sclass);
                    else if (innertext != string.Empty)
                        obj.SearchProperties.Add(HtmlButton.PropertyNames.InnerText, innertext);
                    else if (title != string.Empty)
                        obj.SearchProperties.Add(HtmlButton.PropertyNames.Title, title);
                    else if (displayTxt != string.Empty)
                        obj.SearchProperties.Add(HtmlButton.PropertyNames.DisplayText, displayTxt);
                    if (obj != null)
                    {
                        obj.WaitForControlReady();
                    }
                }
                else
                {
                    Assert.Fail("LocateSharepointPopIframeButtons :: Control not loaded");
                }
                return obj;
            });
        }
        public UITestControl LocateSharepointPopIframeButtonsAndClick(string id = "", string name = "", string sclass = "", string innertext = "", string title = "", string displayTxt = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateSharepointPopIframeButtons(id: id, name: name, sclass: sclass, innertext: innertext, title: title, displayTxt: displayTxt);
                if (ctrl != null)
                {
                    Mouse.Click(ctrl);
                }
                return ctrl;
            });
        }
        public UITestControl LocateSharepointPopIframeButtonsAndDoubleClick(string id = "", string name = "", string sclass = "", string innertext = "", string title = "", string displayTxt = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateSharepointPopIframeButtons(id: id, name: name, sclass: sclass, innertext: innertext, title: title, displayTxt: displayTxt);
                if (ctrl != null)
                {
                    Mouse.DoubleClick(ctrl);
                }
                return ctrl;
            });
        }
        public UITestControl LocateSharepointPopIframeButtonsAndHover(string id = "", string name = "", string sclass = "", string innertext = "", string title = "", string displayTxt = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateSharepointPopIframeButtons(id: id, name: name, sclass: sclass, innertext: innertext, title: title, displayTxt: displayTxt);
                if (ctrl != null)
                {
                    Mouse.Hover(ctrl);
                }
                return ctrl;
            });
        }
        #endregion

        #region Locate Web Table, Span, Div and cell and actions
        public HtmlEditableSpan LocateWebEditableSpan(string pid = "", string pname = "", string pclass = "", string pinnertext = "", string ptitle = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = new HtmlEditableSpan(_dom);
                if (_dom != null)
                {
                    if (pid != string.Empty && pname != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<HtmlEditableSpan>(new { Id = pid, Name = pname });
                    else if (pid != string.Empty && pclass != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<HtmlEditableSpan>(new { Id = pid }, new { Class = pclass });
                    else if (pname != string.Empty && pclass != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<HtmlEditableSpan>(new { Name = pname }, new { Class = pclass });
                    else if (pid != string.Empty && ptitle != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<HtmlEditableSpan>(new { Id = pid }, new { Title = ptitle });
                    else if (pid != string.Empty && pinnertext != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<HtmlEditableSpan>(new { Id = pid }, new { InnerText = pinnertext });
                    else if (pid != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<HtmlEditableSpan>(new { Id = pid });
                    else if (pname != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<HtmlEditableSpan>(new { Name = pname });
                    else if (pclass != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<HtmlEditableSpan>(new { Class = pclass });
                    else if (pinnertext != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<HtmlEditableSpan>(new { InnerText = pinnertext });
                    else if (ptitle != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<HtmlEditableSpan>(new { Title = ptitle });
                    if (ctrl != null)
                    {
                        ctrl.WaitForControlReady();
                    }
                    else
                    {
                        Assert.Fail("LocateWebEditableSpan :: Control not loaded");

                    }
                }
                return ctrl;
            });
        }
        public HtmlEditableSpan LocateWebEditableSpanAndHover(string pid = "", string pname = "", string pclass = "", string pinnertext = "", string ptitle = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebEditableSpan(pid: pid, pname: pname, pclass: pclass, pinnertext: pinnertext, ptitle: ptitle);
                if (ctrl != null)
                {
                    Mouse.Hover(ctrl);
                }
                return ctrl;
            });
        }
        public HtmlEditableSpan LocateWebEditableSpanAndClick(string pid = "", string pname = "", string pclass = "", string pinnertext = "", string ptitle = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebEditableSpan(pid: pid, pname: pname, pclass: pclass, pinnertext: pinnertext, ptitle: ptitle);
                if (ctrl != null)
                {
                    Mouse.Click(ctrl);
                }
                return ctrl;
            });
        }

        public HtmlEditableSpan LocateWebPopEditableSpan(string pid = "", string pname = "", string pclass = "", string pinnertext = "", string ptitle = "")
        {
            return HandleExceptions(() =>
            {
                var getDom = GetHtmlDocument();
                var ctrl = new HtmlEditableSpan(getDom);

                if (getDom != null)
                {
                    getDom.WaitForControlReady();
                    if (pid != string.Empty)
                        ctrl.SearchProperties.Add(HtmlEditableSpan.PropertyNames.Id, pid);
                    else if (pname != string.Empty)
                        ctrl.SearchProperties.Add(HtmlEditableSpan.PropertyNames.Name, pname);
                    else if (pclass != string.Empty)
                        ctrl.SearchProperties.Add(HtmlEditableSpan.PropertyNames.Class, pclass);
                    else if (pinnertext != string.Empty)
                        ctrl.SearchProperties.Add(HtmlEditableSpan.PropertyNames.InnerText, pinnertext);
                    else if (ptitle != string.Empty)
                        ctrl.SearchProperties.Add(HtmlEditableSpan.PropertyNames.Title, ptitle);
                    if (ctrl != null)
                    {
                        ctrl.WaitForControlReady();
                    }
                    else
                    {
                        Assert.Fail("LocateWebPopEditableSpan :: Control not loaded");

                    }
                }
                return ctrl;
            });
        }
        public HtmlEditableSpan LocateWebPopEditableSpanAndHover(string pid = "", string pname = "", string pclass = "", string pinnertext = "", string ptitle = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebPopEditableSpan(pid: pid, pname: pname, pclass: pclass, pinnertext: pinnertext, ptitle: ptitle);
                if (ctrl != null)
                {
                    Mouse.Hover(ctrl);
                }
                return ctrl;
            });
        }
        public HtmlEditableSpan LocateWebPopEditableSpanAndClick(string pid = "", string pname = "", string pclass = "", string pinnertext = "", string ptitle = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebPopEditableSpan(pid: pid, pname: pname, pclass: pclass, pinnertext: pinnertext, ptitle: ptitle);
                if (ctrl != null)
                {
                    Mouse.Click(ctrl);
                }
                return ctrl;
            });
        }

        public HtmlDiv LocateWebDiv(string id = "", string name = "", string sclass = "", string displayText = "", string innertext = "", string title = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = new HtmlDiv(_dom);
                if (_dom != null)
                {
                    _dom.WaitForControlReady();
                    if (id != string.Empty && name != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<HtmlDiv>(new { Id = id, Name = name });
                    else if (id != string.Empty && sclass != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<HtmlDiv>(new { Id = id }, new { Class = sclass });
                    else if (name != string.Empty && sclass != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<HtmlDiv>(new { Name = name }, new { Class = sclass });
                    else if (id != string.Empty && title != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<HtmlDiv>(new { Id = id }, new { Title = title });
                    else if (id != string.Empty && innertext != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<HtmlDiv>(new { Id = id }, new { InnerText = innertext });
                    else if (innertext != string.Empty && sclass != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<HtmlDiv>(new { InnerText = innertext }, new { Class = sclass });
                    else if (displayText != string.Empty && sclass != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<HtmlDiv>(new { DisplayText = displayText }, new { Class = sclass });
                    else if (id != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<HtmlDiv>(new { Id = id });
                    else if (name != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<HtmlDiv>(new { Name = name });
                    else if (sclass != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<HtmlDiv>(new { Class = sclass });
                    else if (innertext != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<HtmlDiv>(new { InnerText = innertext });
                    else if (title != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<HtmlDiv>(new { Title = title });
                    if (ctrl != null)
                    {
                        ctrl.WaitForControlReady();
                    }
                    else
                    {
                        Assert.Fail("LocateWebDiv :: Control not loaded");

                    }
                }
                return ctrl;
            });
        }
        public HtmlDiv LocateWebDivAndHover(string id = "", string name = "", string sclass = "", string displayText = "", string innertext = "", string title = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebDiv(id: id, name: name, sclass: sclass, displayText: displayText, innertext: innertext, title: title);
                if (ctrl != null)
                {
                    Mouse.Hover(ctrl);
                }
                return ctrl;
            });
        }
        public HtmlDiv LocateWebDivAndClick(string id = "", string name = "", string sclass = "", string displayText = "", string innertext = "", string title = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebDiv(id: id, name: name, sclass: sclass, displayText: displayText, innertext: innertext, title: title);
                if (ctrl != null)
                {
                    Mouse.Click(ctrl);
                }
                return ctrl;
            });
        }

        public HtmlDiv LocateWebPopDiv(string id = "", string name = "", string sclass = "", string displayText = "", string innertext = "", string title = "")
        {
            return HandleExceptions(() =>
            {
                var getDom = GetHtmlDocument();
                var ctrl = new HtmlDiv(getDom);

                if (getDom != null)
                {
                    getDom.WaitForControlReady();
                    if (id != string.Empty)
                        ctrl.SearchProperties.Add(HtmlDiv.PropertyNames.Id, id);
                    else if (name != string.Empty)
                        ctrl.SearchProperties.Add(HtmlDiv.PropertyNames.Name, name);
                    else if (sclass != string.Empty)
                        ctrl.SearchProperties.Add(HtmlDiv.PropertyNames.Class, sclass);
                    else if (displayText != string.Empty)
                        ctrl.SearchProperties.Add(HtmlDiv.PropertyNames.DisplayText, displayText);
                    else if (innertext != string.Empty)
                        ctrl.SearchProperties.Add(HtmlDiv.PropertyNames.InnerText, innertext);
                    else if (title != string.Empty)
                        ctrl.SearchProperties.Add(HtmlDiv.PropertyNames.Title, title);
                    if (ctrl != null)
                    {
                        ctrl.WaitForControlReady();
                    }
                    else
                    {
                        Assert.Fail("LocateWebPopDiv :: Control not loaded");

                    }
                }
                return ctrl;
            });
        }
        public HtmlDiv LocateWebPopDivAndHover(string id = "", string name = "", string sclass = "", string displayText = "", string innertext = "", string title = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebPopDiv(id: id, name: name, sclass: sclass, displayText: displayText, innertext: innertext, title: title);
                if (ctrl != null)
                {
                    Mouse.Hover(ctrl);
                }
                return ctrl;
            });
        }
        public HtmlDiv LocateWebPopDivAndClick(string id = "", string name = "", string sclass = "", string displayText = "", string innertext = "", string title = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebPopDiv(id: id, name: name, sclass: sclass, displayText: displayText, innertext: innertext, title: title);
                if (ctrl != null)
                {
                    Mouse.Click(ctrl);
                }
                return ctrl;
            });
        }

        public HtmlTable LocateWebTable(string id = "", string name = "", string sclass = "", string innertext = "", string title = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = new HtmlTable(_dom);
                if (_dom != null)
                {
                    _dom.WaitForControlReady();
                    if (id != string.Empty && name != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<HtmlTable>(new { Id = id, Name = name });
                    else if (sclass != string.Empty && innertext != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<HtmlTable>(new { Class = sclass, InnerText = innertext });
                    else if (name != string.Empty && innertext != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<HtmlTable>(new { Name = name }, new { InnerText = innertext });
                    else if (id != string.Empty && innertext != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<HtmlTable>(new { ID = id }, new { InnerText = innertext });
                    else if (id != string.Empty && sclass != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<HtmlTable>(new { Id = id }, new { Class = sclass });
                    else if (id != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<HtmlTable>(new { Id = id });
                    else if (name != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<HtmlTable>(new { Name = name });
                    else if (sclass != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<HtmlTable>(new { Class = sclass });
                    else if (innertext != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<HtmlTable>(new { InnerText = innertext });
                    if (ctrl != null)
                    {
                        ctrl.WaitForControlReady();
                    }
                    else
                    {
                        Assert.Fail("LocateWebTable :: Control not loaded");

                    }
                }
                return ctrl;
            });
        }
        public HtmlTable LocateWebTableAndHover(string id = "", string name = "", string sclass = "", string innertext = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebTable(id: id, name: name, sclass: sclass, innertext: innertext);
                if (ctrl != null)
                {
                    Mouse.Hover(ctrl);
                }
                return ctrl;
            });
        }
        public HtmlTable LocateWebTableAndClick(string id = "", string name = "", string sclass = "", string innertext = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebTable(id: id, name: name, sclass: sclass, innertext: innertext);
                if (ctrl != null)
                {
                    Mouse.Click(ctrl);
                }
                return ctrl;
            });
        }

        public HtmlTable LocateWebPopTable(string id = "", string name = "", string sclass = "", string innertext = "", string title = "")
        {
            return HandleExceptions(() =>
            {
                var getDom = GetHtmlDocument();
                var ctrl = new HtmlTable(getDom);

                if (getDom != null)
                {
                    getDom.WaitForControlReady();
                    if (id != string.Empty)
                        ctrl.SearchProperties.Add(HtmlTable.PropertyNames.Id, id);
                    else if (name != string.Empty)
                        ctrl.SearchProperties.Add(HtmlTable.PropertyNames.Name, name);
                    else if (sclass != string.Empty)
                        ctrl.SearchProperties.Add(HtmlTable.PropertyNames.Class, sclass);
                    else if (innertext != string.Empty)
                        ctrl.SearchProperties.Add(HtmlTable.PropertyNames.InnerText, innertext);
                    else if (title != string.Empty)
                        ctrl.SearchProperties.Add(HtmlTable.PropertyNames.Title, title);
                    if (ctrl != null)
                    {
                        ctrl.WaitForControlReady();
                    }
                    else
                    {
                        Assert.Fail("LocateWebPopTable :: Control not loaded");

                    }
                }
                return ctrl;
            });
        }
        public HtmlTable LocateWebPopTableAndHover(string id = "", string name = "", string sclass = "", string innertext = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebPopTable(id: id, name: name, sclass: sclass, innertext: innertext);
                if (ctrl != null)
                {
                    Mouse.Hover(ctrl);
                }
                return ctrl;
            });
        }
        public HtmlTable LocateWebPopTableAndClick(string id = "", string name = "", string sclass = "", string innertext = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebPopTable(id: id, name: name, sclass: sclass, innertext: innertext);
                if (ctrl != null)
                {
                    Mouse.Click(ctrl);
                }
                return ctrl;
            });
        }

        public HtmlCell LocateWebCell(string id = "", string name = "", string sclass = "", string innertext = "", string title = "", string rowIndex = "", string columnIndex = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = new HtmlCell(_dom);
                if (_dom != null)
                {
                    _dom.WaitForControlReady();
                    if (id != string.Empty && name != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<HtmlCell>(new { Id = id, Name = name });
                    else if (sclass != string.Empty && innertext != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<HtmlCell>(new { Class = sclass, InnerText = innertext });
                    else if (name != string.Empty && innertext != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<HtmlCell>(new { Name = name }, new { InnerText = innertext });
                    else if (id != string.Empty && innertext != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<HtmlCell>(new { ID = id }, new { InnerText = innertext });
                    else if (id != string.Empty && sclass != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<HtmlCell>(new { Id = id }, new { Class = sclass });
                    else if (rowIndex != string.Empty && columnIndex != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<HtmlCell>(new { }, new { RowIndex = rowIndex, ColumnIndex = columnIndex });
                    else if (id != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<HtmlCell>(new { Id = id });
                    else if (name != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<HtmlCell>(new { Name = name });
                    else if (sclass != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<HtmlCell>(new { Class = sclass });
                    else if (innertext != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<HtmlCell>(new { InnerText = innertext });
                    if (ctrl != null)
                    {
                        ctrl.WaitForControlReady();
                    }
                    else
                    {
                        Assert.Fail("LocateWebCell :: Control not loaded");

                    }
                }
                return ctrl;
            });
        }
        public HtmlCell LocateWebCellAndHover(string id = "", string name = "", string sclass = "", string innertext = "", string title = "", string rowIndex = "", string columnIndex = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebCell(id: id, name: name, sclass: sclass, innertext: innertext, rowIndex: rowIndex, columnIndex: columnIndex);
                if (ctrl != null)
                {
                    Mouse.Hover(ctrl);
                }
                return ctrl;
            });
        }
        public HtmlCell LocateWebCellAndClick(string id = "", string name = "", string sclass = "", string innertext = "", string title = "", string rowIndex = "", string columnIndex = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebCell(id: id, name: name, sclass: sclass, innertext: innertext, rowIndex: rowIndex, columnIndex: columnIndex);
                if (ctrl != null)
                {
                    Mouse.Click(ctrl);
                }
                return ctrl;
            });
        }

        public HtmlCell LocateWebPopCell(string id = "", string name = "", string sclass = "", string innertext = "", string title = "", string rowIndex = "", string columnIndex = "")
        {
            return HandleExceptions(() =>
            {
                var getDom = GetHtmlDocument();
                var ctrl = new HtmlCell(getDom);

                if (getDom != null)
                {
                    getDom.WaitForControlReady();
                    if (id != string.Empty)
                        ctrl.SearchProperties.Add(HtmlCell.PropertyNames.Id, id);
                    else if (name != string.Empty)
                        ctrl.SearchProperties.Add(HtmlCell.PropertyNames.Name, name);
                    else if (sclass != string.Empty)
                        ctrl.SearchProperties.Add(HtmlCell.PropertyNames.Class, sclass);
                    else if (innertext != string.Empty)
                        ctrl.SearchProperties.Add(HtmlCell.PropertyNames.InnerText, innertext);
                    else if (title != string.Empty)
                        ctrl.SearchProperties.Add(HtmlCell.PropertyNames.Title, title);
                    else if (rowIndex != string.Empty && columnIndex != string.Empty)
                        ctrl.SearchAndFilterObjects<HtmlCell>(new { }, new { RowIndex = rowIndex, ColumnIndex = columnIndex });
                    if (ctrl != null)
                    {
                        ctrl.WaitForControlReady();
                    }
                    else
                    {
                        Assert.Fail("LocateWebPopCell :: Control not loaded");

                    }
                }
                return ctrl;
            });
        }
        public HtmlCell LocateWebPopCellAndHover(string id = "", string name = "", string sclass = "", string innertext = "", string title = "", string rowIndex = "", string columnIndex = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebPopCell(id: id, name: name, sclass: sclass, innertext: innertext, rowIndex: rowIndex, columnIndex: columnIndex);
                if (ctrl != null)
                {
                    Mouse.Hover(ctrl);
                }
                return ctrl;
            });
        }
        public HtmlCell LocateWebPopCellAndClick(string id = "", string name = "", string sclass = "", string innertext = "", string rowIndex = "", string columnIndex = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebPopCell(id: id, name: name, sclass: sclass, innertext: innertext, rowIndex: rowIndex, columnIndex: columnIndex);
                if (ctrl != null)
                {
                    Mouse.Click(ctrl);
                }
                return ctrl;
            });
        }

        public HtmlSpan LocateWebSpan(string id = "", string name = "", string sclass = "", string innertext = "", string title = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = new HtmlSpan(_dom);
                if (_dom != null)
                {
                    _dom.WaitForControlReady();
                    if (id != string.Empty && name != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<HtmlSpan>(new { Id = id, Name = name });
                    else if (id != string.Empty && sclass != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<HtmlSpan>(new { Id = id }, new { Class = sclass });
                    else if (name != string.Empty && sclass != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<HtmlSpan>(new { Name = name }, new { Class = sclass });
                    else if (id != string.Empty && title != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<HtmlSpan>(new { Id = id }, new { Title = title });
                    else if (id != string.Empty && innertext != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<HtmlSpan>(new { Id = id }, new { InnerText = innertext });
                    else if (sclass != string.Empty && innertext != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<HtmlSpan>(new { InnerText = innertext }, new { Class = sclass });
                    else if (id != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<HtmlSpan>(new { Id = id });
                    else if (name != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<HtmlSpan>(new { Name = name });
                    else if (sclass != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<HtmlSpan>(new { Class = sclass });
                    else if (innertext != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<HtmlSpan>(new { InnerText = innertext });
                    else if (title != string.Empty)
                        ctrl = _dom.SearchAndFilterObjects<HtmlSpan>(new { Title = title });
                    if (ctrl != null)
                    {
                        ctrl.WaitForControlReady();
                    }
                    else
                    {
                        Assert.Fail("LocateWebSpan :: Control not loaded");

                    }
                }
                return ctrl;
            });
        }
        public HtmlSpan LocateWebSpanAndHover(string id = "", string name = "", string sclass = "", string innertext = "", string title = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebSpan(id: id, name: name, sclass: sclass, innertext: innertext);
                if (ctrl != null)
                {
                    Mouse.Hover(ctrl);
                }
                return ctrl;
            });
        }
        public HtmlSpan LocateWebSpanAndClick(string id = "", string name = "", string sclass = "", string innertext = "", string title = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebSpan(id: id, name: name, sclass: sclass, innertext: innertext);
                if (ctrl != null)
                {
                    Mouse.Click(ctrl);
                }
                return ctrl;
            });
        }

        public HtmlSpan LocateWebPopSpan(string id = "", string name = "", string sclass = "", string innertext = "", string title = "")
        {
            return HandleExceptions(() =>
            {
                var getDom = GetHtmlDocument();
                var ctrl = new HtmlSpan(getDom);

                if (getDom != null)
                {
                    getDom.WaitForControlReady();
                    if (id != string.Empty)
                        ctrl.SearchProperties.Add(HtmlSpan.PropertyNames.Id, id);
                    else if (name != string.Empty)
                        ctrl.SearchProperties.Add(HtmlSpan.PropertyNames.Name, name);
                    else if (sclass != string.Empty)
                        ctrl.SearchProperties.Add(HtmlSpan.PropertyNames.Class, sclass);
                    else if (innertext != string.Empty)
                        ctrl.SearchProperties.Add(HtmlSpan.PropertyNames.InnerText, innertext);
                    else if (title != string.Empty)
                        ctrl.SearchProperties.Add(HtmlSpan.PropertyNames.Title, title);
                    if (ctrl != null)
                    {
                        ctrl.WaitForControlReady();
                    }
                    else
                    {
                        Assert.Fail("LocateWebPopSpan :: Control not loaded");

                    }
                }
                return ctrl;
            });
        }
        public HtmlSpan LocateWebPopSpanAndHover(string id = "", string name = "", string sclass = "", string innertext = "", string title = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebPopSpan(id: id, name: name, sclass: sclass, innertext: innertext);
                if (ctrl != null)
                {
                    Mouse.Hover(ctrl);
                }
                return ctrl;
            });
        }
        public HtmlSpan LocateWebPopSpanAndClick(string id = "", string name = "", string sclass = "", string innertext = "", string title = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebPopSpan(id: id, name: name, sclass: sclass, innertext: innertext);
                if (ctrl != null)
                {
                    Mouse.Click(ctrl);
                }
                return ctrl;
            });
        }

        #endregion

        #region Locate child of a parent object

        public UITestControl LocateWebChildObjectAndHover(UITestControl uc, string id = "", string name = "", string sclass = "", string innertext = "", string title = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebSpan(id: id, name: name, sclass: sclass, innertext: innertext);
                if (ctrl != null)
                {
                    Mouse.Hover(ctrl);
                }
                return ctrl;
            });
        }
        public UITestControl LocateWebChildObjectAndClick(UITestControl uc, string id = "", string name = "", string sclass = "", string innertext = "", string title = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebSpan(id: id, name: name, sclass: sclass, innertext: innertext);
                if (ctrl != null)
                {
                    Mouse.Click(ctrl);
                }
                return ctrl;
            });
        }
        #endregion

        #region Locate Web partial Object of Table, Span, Div and cell and do the actions
        public HtmlDiv LocateWebDivPartialObject(string id = "", string name = "", string sclass = "", string innertext = "", string title = "")
        {
            return HandleExceptions(() =>
            {
                var getDom = GetHtmlDocument();
                var ctrl = new HtmlDiv(getDom);

                if (getDom != null)
                {
                    getDom.WaitForControlReady();
                    if (id != string.Empty)
                        ctrl.SearchProperties.Add(HtmlDiv.PropertyNames.Id, id, PropertyExpressionOperator.Contains);
                    else if (name != string.Empty)
                        ctrl.SearchProperties.Add(HtmlDiv.PropertyNames.Name, name, PropertyExpressionOperator.Contains);
                    else if (sclass != string.Empty)
                        ctrl.SearchProperties.Add(HtmlDiv.PropertyNames.Class, sclass, PropertyExpressionOperator.Contains);
                    else if (innertext != string.Empty)
                        ctrl.SearchProperties.Add(HtmlDiv.PropertyNames.InnerText, innertext, PropertyExpressionOperator.Contains);
                    else if (title != string.Empty)
                        ctrl.SearchProperties.Add(HtmlDiv.PropertyNames.Title, title, PropertyExpressionOperator.Contains);
                    if (ctrl != null)
                    {
                        ctrl.WaitForControlReady();
                    }
                    else
                    {
                        Assert.Fail("LocateWebDivPartialObject :: Control not loaded");

                    }
                }
                return ctrl;
            });
        }
        public HtmlDiv LocateWebDivPartialObjectAndHover(string id = "", string name = "", string sclass = "", string innertext = "", string title = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebDivPartialObject(id: id, name: name, sclass: sclass, innertext: innertext, title: title);
                if (ctrl != null)
                {
                    Mouse.Hover(ctrl);
                }
                return ctrl;
            });
        }
        public HtmlDiv LocateWebDivPartialObjectAndClick(string id = "", string name = "", string sclass = "", string innertext = "", string title = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebDivPartialObject(id: id, name: name, sclass: sclass, innertext: innertext, title: title);
                if (ctrl != null)
                {
                    Mouse.Click(ctrl);
                }
                return ctrl;
            });
        }

        #region newlly created functions

        public HtmlDiv LocateWebDivDisplayTxtAndHover(string id = "", string name = "", string sclass = "", string innertext = "", string title = "")
        {
            return HandleExceptions(() =>
            {
                var ctrl = LocateWebDivPartialObject(id: id, name: name, sclass: sclass, innertext: innertext, title: title);
                if (ctrl != null)
                {
                    Mouse.Hover(ctrl);
                    var itemtext = ctrl.GetProperty("DisplayText").ToString();
                    innertext = itemtext;
                }
                return ctrl;
            });
        }

        #endregion

        #endregion

        #region Locate object and Mouse Right click
        public void LocateWebSpanDivAndMouseRightClick(string pid = "", string pname = "", string pclass = "", string pinnertext = "", string id = "", string name = "", string sclass = "", string innertext = "", string title = "")
        {
            HandleExceptions(() =>
            {
                var tCtrl = LocateWebEditableSpan(pid: pid, pname: pname, pclass: pclass, pinnertext: pinnertext);
                if (tCtrl != null)
                {
                    Mouse.Click(tCtrl, MouseButtons.Right);
                    var ctrl = LocateWebDiv(id: id, name: name, sclass: sclass, innertext: innertext);
                    if (ctrl != null)
                    {
                        Mouse.Hover(ctrl);
                    }
                }

            });
        }
        #endregion

        #region Locate Objects, hoverover and do the actions
        public void LocateWebDivLinkObjectsAndClick(string pid = "", string pname = "", string pclass = "", string pinnertext = "", string ptitle = "", string id = "", string name = "", string href = "", string target = "", string innertext = "")
        {
            HandleExceptions(() =>
            {
                var ctrl = LocateWebDiv(id: pid, name: pname, sclass: pclass, innertext: innertext, title: ptitle);
                if (ctrl != null)
                {
                    Mouse.Hover(ctrl);
                    ctrl.WaitForControlReady(1500);
                    var link = LocateWebLink(href: href, target: target, innertext: innertext, id: id, name: name);
                    if (link != null)
                    {
                        Mouse.Click(link);
                    }
                }
            });
        }
        public void LocateWebDivLinkObjectsAndHover(string pid = "", string pname = "", string pclass = "", string pinnertext = "", string ptitle = "", string id = "", string name = "", string href = "", string target = "", string innertext = "")
        {
            HandleExceptions(() =>
            {
                var ctrl = LocateWebDiv(id: pid, name: pname, sclass: pclass, innertext: innertext, title: ptitle);
                if (ctrl != null)
                {
                    Mouse.Hover(ctrl);
                    ctrl.WaitForControlReady(1500);
                    var link = LocateWebLink(href: href, target: target, innertext: innertext, id: id, name: name);
                    if (link != null)
                    {
                        Mouse.Hover(link);
                    }
                }
            });
        }

        public void LocateWebTableCellAndHover(string pid = "", string pname = "", string pclass = "", string pinnertext = "", string ptitle = "", string id = "", string name = "", string rowIndex = "", string columnIndex = "", string innertext = "")
        {
            HandleExceptions(() =>
            {
                var ctrl = LocateWebTable(id: pid, name: pname, sclass: pclass, innertext: innertext, title: ptitle);
                if (ctrl != null)
                {
                    Mouse.Hover(ctrl);
                    ctrl.WaitForControlReady(1500);
                    var link = LocateWebCell(rowIndex: rowIndex, columnIndex: columnIndex, innertext: innertext, id: id, name: name);
                    if (link != null)
                    {
                        Mouse.Hover(link);
                    }
                }
            });
        }
        public void LocateWebTableCellAndClick(string pid = "", string pname = "", string pclass = "", string pinnertext = "", string ptitle = "", string id = "", string name = "", string rowIndex = "", string columnIndex = "", string innertext = "")
        {
            HandleExceptions(() =>
            {
                var ctrl = LocateWebTable(id: pid, name: pname, sclass: pclass, innertext: innertext, title: ptitle);
                if (ctrl != null)
                {
                    Mouse.Hover(ctrl);
                    ctrl.WaitForControlReady(1500);
                    var link = LocateWebCell(rowIndex: rowIndex, columnIndex: columnIndex, innertext: innertext, id: id, name: name);
                    if (link != null)
                    {
                        Mouse.Click(link);
                    }
                }
            });
        }

        public void WaitUntilNextJobObjectAvailable(UITestControl utc)
        {
            utc.WaitForControlEnabled();
        }
        #endregion

        #region Cleare Cookies & Cache
        public void CleanCookies()
        {
            HandleExceptions(() =>
            {
                if (_browser != null)
                {
                    BrowserWindow.ClearCookies();
                }
            });
        }
        public void CleanCache()
        {
            HandleExceptions(() =>
            {
                if (_browser != null)
                {
                    BrowserWindow.ClearCache();
                }
            });
        }
        #endregion

        #region Error handling
        public void Playback_PlaybackError(object sender, PlaybackErrorEventArgs e)
        {
            e.Result = !e.Error.Message.Contains("Action failed to perform") ? PlaybackErrorOptions.Retry : PlaybackErrorOptions.Skip;
        }

        private static T HandleExceptions<T>(Func<T> func)
        {
            try
            {
                return func();
            }
            catch (UITestControlNotFoundException ex)
            {
                Trace.WriteLine("UITestControlNotFoundException occurred: " + ex.Message);
                Trace.WriteLine("Stack Trace :" + ex.StackTrace);
                return default(T);
            }
            catch (Exception ex)
            {
                Trace.WriteLine("Exception occurred: " + ex.Message);
                Trace.WriteLine("Stack Trace :" + ex.StackTrace);
                return default(T);
            }
        }

        private static void HandleExceptions(Action action)
        {
            try
            {
                action();
            }
            catch (UITestControlNotFoundException ex)
            {
                Trace.WriteLine("UITestControlNotFoundException occurred: " + ex.Message);
                Trace.WriteLine("Stack Trace :" + ex.StackTrace);
            }
            catch (Exception ex)
            {
                Trace.WriteLine("Exception occurred: " + ex.Message);
                Trace.WriteLine("Stack Trace :" + ex.StackTrace);
            }
        }

        #endregion

    }
}
